Here is my sample XML file
<doc>
<total_loops value="0" />
<total_cmds value="0" />
<total_macros value="5" />
<loop1 name="MyLoop1" type="Min" length="20" data="Sample XML File" />
<loop2 name="MyLoop2" type="Sec" length="50" data="some more data" />
<macro1 name ="My Macro" Value ="100-245,C,W1,200-340,DC" />
</doc>
Im trying to get this function to work in order to insert a new nodelist after any particular nodename
Public Function InsertNode(ByVal FilePath As String, ByVal NodeXML As String, byVal AfterThisNode as string) As Boolean
Dim doc As New System.Xml.XmlDocument
doc.Load(FilePath)
Dim nd As System.Xml.XmlNode
nd = doc.DocumentElement.GetElementsByTagName(AfterThisNode).Item(0)
If nd Is Nothing Then 'could not find the node to insert after, then just add to the bottom
'TO DO: need code to add the line of XML to the end of the document
ELSE 'found the node, now insert new line after
TO DO: need code to insert XML line after found node
End If
doc.Save(FilePath)
Return True
End Function
doc.InsertAfter(myNewNode,