From: Andreas K. <and...@ac...> - 2010-06-17 16:56:09
|
Lars Hellström wrote: > Lately, a lot of the projects I've been working on have involved (i) > generating Tcl data structures that could be viewed as a particular > encoding of part of an XML document and (ii) converting said data > structures to XML on output. > > While (i) is always rather specific, the (ii) part tends to be very > generic, and while it's code-wise very short, it kind of worries me > that I'm copying the same procedures from project to project, so I've > been thinking "maybe this should go into tcllib?" As a matter of fact, > I've been somewhat surprised to not already find something along these > lines in there, but maybe it's too elementary to make a package for... The doctools support TMML as output format, which is a XML format. Joe English wrote that plugin (IIRC), and provided tcllib/modules/doctools/mpformats/_xml.tcl containing the more generic support code. This is not a package outright, just a file which is dt_source'd by the {fmt,toc}.tmml files/engines. The _html in mpformats also has bit of generic tag generation. > The intent is not to provide industrial capacity XML handling (there > are well-known compiled extensions for that), but rather to provide a > cheap package that you can put into your script when you just want to > add XML as another output format. > > The latest version of my command is TDLtoXML::xml_from_trees (but never > mind the namespace) on http://wiki.tcl.tk/25681#pagetocbc2b8a8c. This > coverts from a tdom list format to XML (cf. http://wiki.tcl.tk/26156), > and that is perhaps something that should be scrutinised, since putting > something like this in tcllib is an act of blessing its data format. > > Comments, anyone? Not yet, will have to make the time for a look. -- Andreas Kupries Senior Tcl Developer ActiveState, The Dynamic Language Experts P: 778.786.1122 F: 778.786.1133 and...@ac... http://www.activestate.com Get insights on Open Source and Dynamic Languages at www.activestate.com/blog |