Ooops, it's not a detail but I need to precise that if the xml input is not valid (from my custom pret-xml pov), nothing will be processed! Renaud Le 20/11/2010 20:40, Renaud AUBIN a écrit :
Hi ConTeXters,
I have a first "operational" version of my lpeg-based xml pretty printer: http://www.nibua-r.org/gitsnap/pret-xml/ "operational" means:
1 − That pretty printer will type only partially valid xml file <test></other> will be considered valid
is not considered valid … 2 − A real namespace management is missing, thus foons declarations will be prettyfied as standard attribute and foo: will be processed just as plain tag name.
3 − Endlines within CharData are not yet supported.
As I'm a lua and lpeg beginner, the code provided is not subtle nor optimized…
That pretty printer is slightly different of standard pretty printer since a lpeg grammar is applied on a full buffer, i.e. not on a line-pre-line based approach. The main drawback, not verified, is that if you have a huge xml file to process, it will just explode the stack… An analogy: in memory tree xml vs. parser…
It's far from perfect but you are welcome to use, review and give feedbacks…
(… and OK, it's not packaged as a third party module yet…)
Renaud