Using XML in Tcl

I used to do quite a bit of Tcl programming back in the mid to late 1990s. I've since largely dropped it, but Tcl still is used quite a bit in specialized use cases.

To use Tcl with XML, it seems like the most popular solution is the TclXML package :

From what I can tell, it's the best / only package for XML in Tcl, although here's a 11-year old article by Steve Ball which seems to reference other approaches :

Here's one reference which alludes to concerns about generating XML and a few solutions :

Steve Ball succinctly advised, "When creating XML, I generally use TclDOM. Create a DOM tree in memory, and then use 'dom::DOMImplementation serialize $doc' to generate the XML. The TclDOM package will make sure that the generated XML is well-formed.

It looks like Steve Ball is the author of TclXML, TclDOM and TclXSLT, so his home-cooked solution is expected.

I ran across another code fragment from the same Steve Ball here ( which I like because it apparently works off a DTD so it provides a higher level of document validity.

xml::generate [xml::parseDTD $dtd] set xmlDocument [MEMO priority Important { TO {xml::text "All WWW7 Attendees"} FROM {xml::text "Steve Ball"} MESSAGE {xml::text "XML is terrific!"} }]

Finally, I also ran across this paper from, again, Steve Ball. It's at least written in this millennium :