in reply to inserting text into an XML tree

Kind of a kludge but one may might be to wrap the text in a unique root node, parse it and then insert all of the nodes/subtrees under your root node into the DOM to be printed.