[XML-SIG] merging two separate DOM trees.

chris davis chris@rpgarchive.com
Sun, 2 Apr 2000 23:16:24 -0500


I'm hoping someone can help me on this.  I'm using DOM in my application and
I want to insert a xml document into another xml document at a specific
node.   I'm using DOM and I tired the following.

reader = utils.FileReader(f.GetPath())
new_doc = reader.document
utils.strip_whitespace(doc)
new_xml_node = doc.get_firstChild()
old_xml_node.insertBefore(xml_node,None)
....

At this point I get the "Node created from a different document" error.
I understand what's causing the error, but how can I merge two DOM trees
together. I Use DOM extensively in my app, so I'd really like to accomplish
this without having to move the XML data to a different abstraction, but
I'll take any solution at this point.  Thanks.



chris davis
chris@rpgarchive.com

http://www.rpgarchive.com
adventure database and open news forum

http://www.openrpg.com
check out OpenRPG! open source online rpg!