Click here to Skip to main content
15,909,440 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have the following xml file. What I need to do is modify the values in two places within the Settings tag. I need to change the
<value>1
to <value>3. The second Settings tag the <value>7
to <value>9. Can someone help? I was successful making the change on the first
<settings>
<key>LobbyID
<value>1


but not the second. Here is my code.


Dim MyXML As New XmlDocument()

MyXML.Load(PathToFile)

Dim MyXMLNode As XmlNode = MyXML.SelectSingleNode("/NewDataSet/Settings")

If MyXMLNode IsNot Nothing Then

MyXMLNode.ChildNodes(0).InnerText = "LobbyID"
MyXMLNode.ChildNodes(1).InnerText = "1"


Else

End If ' Save the Xml.

MyXML.Save(PathToDIR)



<newdataset>
<settings>
<key>LobbyID
<value>1

<settings>
<key>WindowID
<value>7



Kevin xiong
kvnxiong@yahoo.com
Posted
Comments
Sergey Alexandrovich Kryukov 20-Jun-13 16:51pm    
You need to tag also ".NET", "VB.NET" or both. This is important for your, to bring your post to the attention of right people.
—SA

1 solution

Search around a little next time,

XML File Parsing in VB.NET[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900