|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Merging two XMLDOM objects
Hi all,
I have a situation where an XML doc is loaded into a Microsoft.XMLDOM object. Depending on a users selections another XML doc is accessed, it has the same structure (i.e. obeys the same schema). Can I merge it with the already loaded document? If so what methods do I call to do it? |
|
#2
|
||||
|
||||
|
Can you do something like this?
Code:
var xmlDoc1 = new ActiveXObject("Msxml2.DOMDocument.4.0");var xmlDoc2 = new ActiveXObject("Msxml2.DOMDocument.4.0");
var root1;
var root2;
var elementToAdd;
xmlDoc1.load("doc1.xml");
xmlDoc2.load("doc2.xml");
root1 = xmlDoc1.documentElement;
root2 = xmlDoc2.documentElement;
var intLength = root2.childNodes.length;
for (intIndex = 0; intIndex < intLength; intIndex++)
{
elementToAdd = root2.childNodes.item(intIndex);
root1.appendChild(elementToAdd);
}
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Merging two XMLDOM objects |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|