Mildly offtopic, I have a bit of recent experience using tdom to build XML documents. If you decide to write your own wrappers, and haven't figured this stuff out yet, I found these commands helpful: dom createDocument, domDoc createElement, domNode setAttribute, domNode appendChild, domDoc asXML.
http://www.tdom.org/dom.html
http://www.tdom.org/domDoc.html
http://www.tdom.org/domNode.html
Here's some sample code:
http://grumet.net/writing/programmer/openacs/rsstv-feed-procs.tcl.txt