I'm getting the following error message but I can't figure out why.
Here is a code snipet
Does anyone have any ideas? What does that error message mean?
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