tags:

views:

17

answers:

1

How do I insert one xmldom object to a node of another xmldom object in javascript?

Thanks in advance

+1  A: 

Just add the node where you want:

xmlDoc=loadXMLDoc("books.xml");

newNode=xmlDoc.createElement("book");

x=xmlDoc.documentElement;
y=xmlDoc.getElementsByTagName("book")[3];

x.insertBefore(newNode,y);

http://www.w3schools.com/Dom/dom_nodes_add.asp

altCognito