[NTG-context] Reading XML with lua

Axel Kielhorn tex at axelkielhorn.de
Fri May 3 17:24:39 CEST 2019


Hi,

I’ m finally at a point where I can read an XML file look at it and write it back.

Right now I have two problems:

1. There are many empty entries in the table.
This makes processing the file a little tedious since I have to filter the real entries.

2. Some entries contain leading and trailing whitespace and linkebreaks.
These are the result of formatting the XML file.
Shouldn't
strip_cm_and_dt
take care of them?
Or do I use that incorrectly?

I have included my lua file and an example xml.
You can run it with
mtxrun —script p.lua

Greetings Axel



-------------- next part --------------
A non-text attachment was scrubbed...
Name: doclist.xml
Type: application/xml
Size: 2416 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20190503/ee37b7eb/attachment.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.lua
Type: application/octet-stream
Size: 958 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20190503/ee37b7eb/attachment.obj>


More information about the ntg-context mailing list