What: xmlgen / htmlgen
Where: http://bras.berlios.de/xmlgen-htmlgen.tar.gz Description: Extension for easy, dynamic creation of HTML/XML with Tcl. Works in a fashion similar to cgi.tcl . xmlgen can be used to generate XML; htmlgen is built on top of xmlgen to generate HTML. Currently at 1.4.0 . Updated: 05/2002 Contact: mailto:[email protected] (Harald Kirsch)
The package is no longer hosted at bras.berlios.de Find its new home at
http://sourceforge.net/projects/tclxml/
where it is called xmlgen, or go directly via
http://sourceforge.net/project/showfiles.php?group_id=13178&release_id=90617
SC I've just been reading about Genx [L1 ] which is a C library for generating XML written by Tim Bray. The main differences between the capabilities of xmlgen and Genx seem to be:
So, I had a quick think about how to do namespaces with xmlgen and came up with the following syntax:
xmlns rdf "http://http://www.w3.org/1999/02/22-rdf-syntax-ns\#" xmlns rdfs "http://www.w3.org/2000/01/rdf-schema\#" declaretag foo -namespace rdf declaretag bar -namespace rdfs foo ! { bar - This is content bar - this is also content }
To make this work, the root element should have the namespace declaration attributes included:
<foo xmlns:rdf="http..." xmlns:rdfs="http..."> <bar>...</bar> </foo>
A quick look at the code makes me think that this modification might not be too hard to make (add the ns attributes in makeTagAndBody when the indent is "" -- or perhaps more properly add a nesting counter and add the attributes when it's zero). Having figured this out I might well go an implement this next time I need to generate XML with namespaces, this note is just in case anyone else wants to have a go instead.
09nov05 jcw - For a somewhat unconventional use of this package, see An indentation syntax for Tcl, end of page.
Harald Kirsch [ Category Application | Category Package | Category XML | ]