From: Lars H. <Lar...@re...> - 2010-06-18 08:18:19
|
Andreas Kupries skrev: > 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. [snip] >> 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. Note that TDL is just one of the projects where XML generation pops up. One could envision a package for both TDL and XML, but it's not something I'm suggesting here and now. > "The trick is to parse TDL data by evaluating it in an empty slave > interpreter." > > Are you limited to Tcl 8.4 ? If not, i.e. 8.5 is viable, then usage of > a namespace and 'namespace unknown' may allow us to forego the empty slave. No, for security reasons that wouldn't be good; you can always give a fully qualified named even from within a given namespace. > What I am missing is some explanation on how you envision the dnyamic > creation of TDL structures. Plain [list] commands ? Right now I only see > static structures on the page, and their conversion to other formats > (data tress, pretty printing, ...) For dynamic generation, you might instead want to look at Part III of http://abel.math.umu.se/~lars/mtmtcl/interfaces.pdf (page 79 and forth); that's one of the other projects. In yet another project, I've been generating SVG for inlining into XHTML... > Having read this I now also see that the _xml.tcl I mentioned in my > first mail is more of a low level generator which would be driven by > such data structures. Assembler in essence, versus your HLL. I'll have to take a look at it. Must rush now. > The xmlgen/htmlgen refeenced on your pages are much more comparable to > the _xml.tcl Lars Hellström |