' Load the document. Dim Doc As New XPathDocument("Data.xml") ' Navigate the document with an XPathNavigator. Dim Navigator As XPathNavigator = Doc.CreateNavigator() ' Move to the root <Debts> element. Navigator.MoveToRoot() ' Move to the first contained <User > element. Navigator.MoveToFirstChild() ' Write a new Child Dim Writer As XmlWriter = Navigator.AppendChild() ' ERROR HERE!!!!!! ' And insert the tag navigator.AppendChild.WriteStartElement("User" + NoOfDebtRecs.ToString()) ' And the data Writer.WriteElementString("Name", TextReturned.ToString()) ' Clear the text box for next time AddUser.TextBoxUserName.Text = "" |
XML editing
When i try to use any of the XML editing functions within the XPath class i always get a method is not supported error. Why is this

XML editing
embedded
DevJohan
Its so much more easy when you know how!
Thanks James.
Phil WInder
Julia Semenova
Let me try to explain. The underlying document object model (DOM) can be XPathDocument or XmlDocument (or a few others like XmlDataDocument). Each is optimized for a different scenario. XPathDocument is like a read-only, forward-only cursor in a database. You can call update methods using the cursor, but they will fail because the cursor isn't writable. You can also open an updatable cursor like a keyset cursor. You use the same methods and you will successfully update the data. Does this make more sense
Nidal-Fouad-Hajj-Youssef
HS-Immeronline
Phil Winder
MarkR&#42;&#42;&#42;
Thanks James
Phil Winder
Mathieu Cupryk
' Load the document.
Dim Doc As New XmlDocument("Data.xml")
' Navigate the document with an XPathNavigator.
Dim Navigator As XPathNavigator = Doc.CreateNavigator()
' Move to the root <Debts> element.
Navigator.MoveToRoot()
' Move to the first contained <User > element.
Navigator.MoveToFirstChild()
' Write a new Child
Dim Writer As XmlWriter = Navigator.AppendChild() ' ERROR HERE!!!!!!
' And insert the tag
navigator.AppendChild.WriteStartElement("User" + NoOfDebtRecs.ToString())
' And the data
Writer.WriteElementString("Name", TextReturned.ToString())
' Clear the text box for next time
AddUser.TextBoxUserName.Text = ""
JosAnt
"The < XML:NAMESPACE PREFIX = MSHelp NS = "http://msdn.microsoft.com/mshelp" />
Thanks
Phil Winder
mshola