Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

documentElement.childNodes problem

Status
Not open for further replies.

caesarkim

Programmer
Oct 30, 2003
56
US
I have a new xml(B) that needs to merge into another XML(A).

I am using documentElement.childNodes for merging. The weird thing is that It does not merge properly.

I have the correct number of nodes in B xml. but when it iterates and appends to B xml, for some reason it does not append all nodes from A xml to B xml.

the B xml has 6 nodes and A has 1 node. so in total it is supposed to be 7 nodes. but it shows only 4 nodes.

here is my code.
---------------------------------------------------------
var msgs = datasrc.documentElement.childNodes;
alert("length: "+ msgs.length);
for (var i=0; i<msgs.length; i++)
{
var msg = msgs.item(i);
original.documentElement.appendChild(msg);
}
alert("total xml\n" + original.xml);


does anybody know why or know any site that I can look up?

Please help.

 
Do this instead.
[tt]
var msgs=new Enumerator(datasrc.documentElement.childNodes);
for (;!msgs.atEnd();msgs.moveNext()) {
original.documentElement.appendChild (msgs.item());
}
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top