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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert position Node must be a Child of the Node to insert 1

Status
Not open for further replies.

ddiamond

Programmer
Apr 22, 2005
918
US
I'm getting the following error message but I can't figure out why.
Insert position Node must be a Child of the Node to insert.

Here is a code snipet
Code:
  Set XmlDoc = CreateObject("Microsoft.XMLDOM")
  XmlDoc.async = "false"
  XmlDoc.Load ".\myTestFile.xml"
  Set CurrentNode = XmlDoc.selectSingleNode("//FIELD[@NAME='POLICY NBR']")
  Set Element = XmlDoc.documentElement
  Set NewNode = XmlDoc.createElement(sName)
  Set NewText = XmlDoc.createTextNode(sText)
  NewNode.appendChild NewText
  Element.insertBefore NewNode, CurrentNode
Does anyone have any ideas? What does that error message mean?

 
>Element.insertBefore NewNode, CurrentNode
This is the meaning of the error.
[tt][red]CurrentNode.parentNode[/red].insertBefore NewNode, CurrentNode[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top