I am trying to parse an XML file that is setup like so:
<root>
<Section category="Device_Type" CodeLength="1">
<item code="C">Cart</item>
<item code="D">Desktop</item>
<item code="L">Laptop</item>
<item code="T">Tablets</item>
<item code="V">Virtual</item>
<item code="R">Robobox</item>
</Section>
<Section category="Building" CodeLength="3">
<item code="1PE">Address</item>
<item code="SL1">Address</item>
<item code="LR1">Address</item>
<item code="LL8">Address</item>
...
</Section>
I have been following this article http://www.codeproject.com/Articles/4826/XML-File-Parsing-in-VB-NET
I can read the file, and I figured out how to get all of the item nodes, however I can't figure out how to get the items that are in a single section.
For example, I am trying to get all items that are in the section where the category is Building.
This is what I have so far...
Private Sub TabItem_Loaded(sender As Object, e As RoutedEventArgs)
Dim XMLDoc As New Xml.XmlDocument
Dim Nodelist As Xml.XmlNodeList
Dim Node As Xml.XmlNode
XMLDoc.Load("\\ukhcdata\share\ITS Shared Files\Rename Computer XML\NamingStandardsCode.xml")
Nodelist = XMLDoc.SelectNodes("/root/Section/item")
For Each Node In Nodelist
Dim itemCode = Node.Attributes.GetNamedItem("code").Value
MsgBox(itemCode.ToString)
Next
End Sub