![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Hi, I uploaded a new beta which may be of interest to xml lovers. The current (mkii) XML handler is based on hooking code into active < characters. This works ok but has limitations. In MKIV we will have an alternative method which has a few advantages: = you have access to arbitrary elements using a subset of xpath = you can attach fully expandable hooks to elements, using 'setups' = for manu cases xml processing is faster (no need for definitions and save/flush) = with lua as programming environemnt rather tricky manipulations are possible The downside of this method is = loading a document eats a bit of memory Think of this: First we load a file (pretty fast btw given that the whole tree is built in memory in such a way that it can also be flushed as-is) \xmlload{main}{cont-en.xml}{} We hook a specific setup into one of the elements \xmlgrab{main}{cd:command}{cd-demo} This setup is (here #1 represents the current node): \startxmlsetups cd-demo \NC \xmlatt{#1}{name} \NC \xmlatt{#1}{file} \NC \NR \stopxmlsetups Now we can say: \starttabulate[|l|l|] \NC command \NC file \NC \NR \xmlall{main}{//cd:command} \stoptabulate This gives us a two column table There is a truckload of (to be documented) commands, for instance one can filter wlements with: first \xmlfilter{main}{cd:command/first()} \blank[2*big] last \xmlfilter{main}{cd:command/last()} \blank[2*big] first \xmlfirst{main}{cd:command} \blank[2*big] last \xmllast {main}{cd:command} \blank[2*big] You can flush whole (sub)trees, access elements by index, etc A variant of the table builder (without the need for adding hooks) is \startxmlsetups cd-demo \NC \xmlatt{#1}{name} \NC \xmlatt{#1}{file} \NC \NR \stopxmlsetups \starttabulate[|l|l|] \NC command \NC file \NC \NR \xmlcommand{main}{//cd:command}{cd-demo} \stoptabulate Or: \startxmlsetups another-demo \NC \xmlatt{#1}{name} \NC \xmlatt{#1}{file} \NC \NR \stopxmlsetups \starttabulate[|l|l|] \NC command \NC file \NC \NR \xmlfilter{main}{//cd:command/command('another-demo')} \stoptabulate I reimplemented the presentation mml module (partially) using this mechanism. The regular definitions still work but processing a file is done differently: \xmlprocess{id}{filename}{optional initiaization setup} It probably takes a while to get accustomed to this, but this mixture of stream and tree handling of xml files looks promising. The current functionality is still experimental and details may change but the base is there. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------