From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/107846 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Gerben Wierda Newsgroups: gmane.comp.tex.context Subject: Which lua XML library is embedded in LMTX? Date: Thu, 25 Jun 2020 12:37:04 +0200 Message-ID: <39CD0D48-A489-44AB-A254-30E7C52E1AD8@rna.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: multipart/mixed; boundary="===============0244783820849422032==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="124163"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Jun 25 12:37:22 2020 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1joPFx-000WCX-Vz for gctc-ntg-context-518@m.gmane-mx.org; Thu, 25 Jun 2020 12:37:22 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 12B7E18518C; Thu, 25 Jun 2020 12:37:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8dZRKFh89t3N; Thu, 25 Jun 2020 12:37:07 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2FC8A1850F2; Thu, 25 Jun 2020 12:37:07 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 6CC2C1850B4 for ; Thu, 25 Jun 2020 12:37:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Maqe7-UZ3iQZ for ; Thu, 25 Jun 2020 12:37:05 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=213.125.118.53; helo=mail.rna.nl; envelope-from=gerben.wierda@rna.nl; receiver= Original-Received: from mail.rna.nl (mail.rna.nl [213.125.118.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 2528F184FF2 for ; Thu, 25 Jun 2020 12:37:05 +0200 (CEST) Original-Received: from hermione.rna.nl (hermione.rna.nl [192.168.2.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.rna.nl (Postfix) with ESMTPSA id 9222A53AAAD5 for ; Thu, 25 Jun 2020 12:37:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rna.nl; s=dkim_rsa2048; t=1593081424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=HGslCOMRiUiY17fzjcjnLJSUXXfInhas8nFVe0e/bT8=; b=SshGBW32v/fH4GlW3h4V+4IPBdOXZTCndTC1HlQB2RihNOH9l7nUFW+KwYSwBiF4RVJqxE 1avWFHg8MO6Z1kC1vsg4yzztv7ry23+WWMRf/UUBUr2fQqHTxpLdfufcBRosGOYPZkZQv8 OwysvRt/ifErOqMy7yzGm4viBHmlucwv31nuhClIGnvo66a7xh3kfz9LikIm8XYYKRVbM/ o0yY5KWdkxqJbv7ftjjy1DRWZiI9znIhj2tJQ0sdDiD29TQw9IhGcdzKDwBCXTZNILVVbf 3OLBj2xslFUDnTh+PnNrnQdgIFrNkSlAN+hk6TNgidVrXFbXGeXqrdQFJ/CZXg== X-Mailer: Apple Mail (2.3445.104.14) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:107846 Archived-At: --===============0244783820849422032== Content-Type: multipart/alternative; boundary="Apple-Mail=_BCBAC9D1-9AF3-423A-9B24-24D21C028ABB" --Apple-Mail=_BCBAC9D1-9AF3-423A-9B24-24D21C028ABB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii According to the XML manual: << 2.1 >> TEX versus LUA It will not come as a surprise that we can access xml files from TEX as = well as from Lua. In fact there are two methods to deal with xml in Lua. = First there are the low level xml functions in the xml namespace. On top = of those functions there is a set of functions in the lxml namespace = that deals with xml in a more TEXie way. << 3.7 >> manipulation You can use Lua code to manipulate the tree and it makes no sense to = duplicate this in TEX. In the future we might provide an interface to = some of this functionality. Keep in mind that manipuating the tree might = have side effects as we maintain several indices into the tree that also = needs to be updated then.=20 Having read that, I was loooking for the documentation of the commands = that are available in the xml namespace. I want to manipulate a XML tree = in LMTX lua. But looking online gives me all kinds of different = XML-solutions that are proposed for lua. Which one is embedded in LMTX = and available in the xml namespace? But then I get confused because = other elements like xml.first, xml.collected are in the xml namespavce = and mentioned. So, maybe I misunderstand things and is the documentation in=20 << 5.5 >> selectors and injectors This section describes a bit special feature, one that we needed for a = project where we could not touch the original content but could add = specific sections for our own purpose. Hopefully the example = demonstrates its useability.=20 But that part I do not understand. What I need (in LMTX lua) to add (sub)nodes to the XML node (that I read = with xml.first()) because the data I get is broken and I need to fix it = before I can use it (and I cannot get good data) The easiest way is to = add the correct data to the XML and then use it in my code. If I cannot = do that I need to write parallel code that largely does the same as what = I already have (ugh).. G= --Apple-Mail=_BCBAC9D1-9AF3-423A-9B24-24D21C028ABB Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii According to the XML manual:

<< 2.1 >> TEX versus LUA

It will not come as a surprise that we can access xml files from TEX as well as from Lua. In fact there are two methods to deal with xml in Lua. First there are the low level xml functions in the xml namespace. On top of those functions there is a set of functions in the lxml namespace that deals with xml in a more TEXie way.

<< 3.7 >> manipulation

You can use Lua code to manipulate the tree and it makes no sense to duplicate this in TEX. In the future we might provide an interface to some of this functionality. Keep in mind that manipuating the tree might have side effects as we maintain several indices into the tree that also needs to be updated then. 


Having read that, I was loooking for the documentation of the commands that are available in the xml namespace. I want to manipulate a XML tree in LMTX lua. But looking online gives me all kinds of different XML-solutions that are proposed for lua. Which one is embedded in LMTX and available in the xml namespace? But then I get confused because other elements like xml.first, xml.collected are in the xml namespavce and mentioned.

So, maybe I misunderstand things and is the documentation in 

<< 5.5 >> selectors and injectors

This section describes a bit special feature, one that we needed for a project where we could not touch the original content but could add specific sections for our own purpose. Hopefully the example demonstrates its useability. 

But that part I do not understand.

What I need (in LMTX lua) to add (sub)nodes to the XML node (that I read with xml.first()) because the data I get is broken and I need to fix it before I can use it (and I cannot get good data) The easiest way is to add the correct data to the XML and then use it in my code. If I cannot do that I need to write parallel code that largely does the same as what I already have (ugh)..

G
--Apple-Mail=_BCBAC9D1-9AF3-423A-9B24-24D21C028ABB-- --===============0244783820849422032== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============0244783820849422032==--