Imports System.Xml.Linq
' Get the Document loaded
Dim xdoc As XDocument = XDocument.Load("Test.xml")
' Get all the Data1 nodes and print out all there inner text
For Each data As XElement In xdoc...<Data1>
Console.WriteLine(data.Value)
Next
Public Sub LoadUserRank(ByVal RankID As String)
Dim XMLDoc As New XmlDocument
XMLDoc.Load(frmMain.txtBrowse.Text)
Dim nodes As XmlNodeList = XMLDoc.SelectNodes("//Rank")
For Each node As XmlNode In nodes
If node.ChildNodes(0).InnerText = RankID Then
frmMain.txtRank.Text = node.ChildNodes(1).InnerText
End If
Next
End Sub
- <Guild>
- <Ranks>
- <Rank>
<Id>0</Id>
<Name>Test1</Name>
</Rank>
- <Rank>
<Id>1</Id>
<Name>Test2</Name>
</Rank>
</Ranks>
</Guild>
Open in new window
Remembering to add the line "Imports System.Xml" at the top of your code file.