I have an XML document similar to plists on Mac OS X:
<?xml version="1.0" encoding="UTF-8"?>
<dict>
<key>MyKey</key>
<string>ABC</string>
</dict>
I successfully can retrieve the text node which holds the value “ABC”, but I can not change the value. I get an XMLException with the number 0.
Dim node As XmlNode = Document.XQL("dict/key[text()='MyKey']/following-sibling::*[1]").Item(0)
If node.Name = "string" Then
Dim textNode As XmlTextNode = XmlTextNode(node.FirstChild)
MsgBox(textNode.Value) // this works and shows "ABC"
textNode.Value = "XXX" // <--- XMLException with number 0
ElseIf node.Name = ...
What am I doing wrong? Do I need to delete the node and replace it (this shouldn’t be necessary as far as I have been able to understand from the Expat website).