(moved to here, misposted in
vb 2002-2003)
Hi i have an xml file that looks like this
<?xml version="1.0" encoding="utf-8"?>
<myRoot />
I would like to add child? elements to my myRoot element using
vb .net2. I am getting "This document already has a 'DocumentElement' node." Error with the following code
Dim myXmlDoc As XmlDocument = New XmlDocument()
Dim myElement As XmlElement
myXmlDoc.Load("c:\test.xml")
myElement = myXmlDoc.CreateElement("newChild")
myXmlDoc.AppendChild(myElement)
myXmlDoc.Save("c:\test.xml")
Can anyone help with this please (im new to this) and have googled for a bit on this, which only seemd to complicate it for me.
Visual Studio 2005 (sp1)
dotnet 2.0
Thanks in advance for any help or improvements to this
Regards