Altova Mailing List Archives

.replceChild problem

From: itsnavin@-----.--- (----- -----)
Date: 3/5/2004 8:32:00 AM
I am trying to change existing XML with new XML with replaceChild()
Here is old XML:
 <list name="AIS_LISTITEMS" area="AIS">
	<item code="AIS" desc="Some Description"/>
	<item code="ALLIANCE" desc="Some other"/>
	<item code="AIR" desc="More desc"/>
	<item code="APT" desc="I have some more"/>
	<item code="AIM" desc="last desc"/>

New XML:
<list name="AIS_LISTITEMS" area="AIS">
	<item code="AZZ" desc="Some Description"/>
	<item code="ALL" desc="Some other"/>
	<item code="APR" desc="More desc"/>
	<item code="YYY" desc="I have some more"/>
	<item code="ZZZ" desc="last desc"/>

And I want to replace the whole of the list named "AIS_LISTITEMS" in
the oldXML with the new XML.
What I am doing is something like this:

var newDOM = new ActiveXObject("MSXML2.DOMDocument.4.0");
newDOM.async = false;
var newChild = newDOM.selectSingleNode("//list")

var oldDOM = new ActiveXObject("MSXML2.DOMDocument.4.0");
oldDOM.async = false;
var oldChild = objXML.selectSingleNode("//list[@name='REQTYPE']")

var temp = objXML.documentElement.childNodes.item(1).replaceChild(newChild,

'temp' should give me the replaced node but instead it gives me error
as "Insert position Node must be a Child of the Node to insert under."

Could any one let me know what wrong with my code and how to correct
it as well
Thanks a lot.
Navin Kumar


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.