The oacs-dav package uses it too, see tDAV-procs.tcl. Main lesson is, tdom is your friend. The tdom docs are here: http://www.tdom.org/doc-index.html
Here are a couple of my most-used tdom utility functions (probably belong in the toolkit somewhere if alternatives aren't readily available):
ad_proc -public ps_simpleTextElement {doc name value} {} {
set element_node [$doc createElement $name]
set value_node [$doc createTextNode $value]
$element_node appendChild $value_node
return $element_node
}
ad_proc -public ps_rfc822date seconds {} {
return [ns_fmttime $seconds "%a, %d %b %Y %T %Z"]
}