Here's a little start for updating an XML node, please see below for example. You'll need to make a few adjustments as necessary to fit your needs. The code you provided is only for reading and creating an XML file, not updating one as you indicated. With this in mind I'm not sure what node you're looking for (maybe "node"), but in my example...
"YOURNODE" - Change this to the node you are looking for
"NEW NODES TEXT" - Change this to what you want the node to be (text)
Dim MyXML As New XmlDocument()
MyXML.Load(Application.StartupPath & "MyXML.xml")
Dim MyXMLNode As XmlNode = MyXML.SelectSingleNode("YOURNODE")
'If we have the node let's change the text
If MyXMLNode IsNot Nothing Then
MyXMLNode.ChildNodes(0).InnerText = "NEW NODES TEXT"
Else
'Do whatever
End If
'Save the XML now
MyXML.Save(Application.StartupPath & "MyXML.xml")
Code Edit Per Your Requirements
We have to dig down into the child nodes, once we have it we can change that text...
Dim MyXML As New XmlDocument()
MyXML.Load(Application.StartupPath & "MyXML.xml")
Dim MyXMLNode As XmlNode = MyXML.SelectSingleNode("Data")
'If we have the node let's change the text
If MyXMLNode IsNot Nothing Then
Dim MyXMLNodes As XmlNodeList
MyXMLNodes = MyXMLNode.ChildNodes(0).ChildNodes
'Set the nodes text
If MyXMLNodes IsNot Nothing Then
MyXMLNodes.Item(0).InnerText = "NEW NODES TEXT"
End If
'Save the XML now
MyXML.Save(Application.StartupPath & "MyXML.xml")
End If
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…