Are you creating and inserting DOM nodes on the fly, when looping through the XML doc? or are you pulling HTML from the XML file and trying to insert that?