ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Gerben Wierda <gerben.wierda@rna.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Which lua XML library is embedded in LMTX?
Date: Thu, 25 Jun 2020 12:37:04 +0200	[thread overview]
Message-ID: <39CD0D48-A489-44AB-A254-30E7C52E1AD8@rna.nl> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1931 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 5334 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2020-06-25 10:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25 10:37 Gerben Wierda [this message]
2020-06-26 11:42 ` Taco Hoekwater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39CD0D48-A489-44AB-A254-30E7C52E1AD8@rna.nl \
    --to=gerben.wierda@rna.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).