I believe the bug is here:
if { ![empty_string_p $node] } {
# return [dom::node cget [dom::node cget $node -firstChild] -nodeValue]
return [ns_xml node getcontent [lindex [ns_xml node children $node] 0]]
The code that converts to ns_xml exactly mirrors the TclDOM code. The behaviour of ns_xml is not exactly like a DOM implementation.
ns_xml node getcontent will get whatever is inside the current tag pair. I think this will fix it:
return [ns_xml node getcontent $node]
getcontent automatically goes to the next node (the text node).
I ran into this porting XML-RPC for Tcl to use ns_xml.