[NTG-context] Reading XML with lua

Hans Hagen j.hagen at xs4all.nl
Mon May 6 11:04:12 CEST 2019


On 5/3/2019 5:24 PM, Axel Kielhorn wrote:
> 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?

no, as comments and doctype definitions are not the same as spaces

> Or do I use that incorrectly?

the stored xml is largely roundtrip

> I have included my lua file and an example xml.
> You can run it with
> mtxrun —script p.lua
> 
> Greetings Axel
> 
> 
> 
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context at 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
> ___________________________________________________________________________________
> 


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list