I am trying to parse the below Xml. It could have multiple invoice tags:
<Invoices>
<Invoice>
<Invoice_ID>1234</Invoice_Id>
<Billing>
<Name> abc </Name>
<Address1>1 main street</Address1>
<City> city </city>
<State>State </State
<Zip>00000</zip>
<Amount>
<BaseAmt>35</BaseAmt>
<Tax>3</Tax>
<Total>28<total>
<Amount>
</Billing>
<item>
<Name> pen </Name>
<qty> 5 </qty>
<amount> 10 </amount>
</item>
<item>
<Name> Paper </Name>
<qty> 3 </qty>
<amount> 20 </amount>
</item>
</Invoice>
</Invoices>
Below is my code :
Dim xmlDoc As XmlDocument = New XmlDocument()
xmlDoc.Load(fileName)
Dim invNum As Integer = 0
Dim nodeLst As XmlNodeList = xmlDoc.SelectNodes("/Invoices/Invoice")
invNum = nodeLst.Count
For Each invDetail As XmlElement In nodeLst
Dim invID As String = invDetail("Invoice_ID").InnerText.ToString()
Next
I need to get the value for the remaining tags i.e child nodes like Billing/Name , Billing/Name/Amount , Items/Items/Name
SelectSingleNode("Billing"), thenSelectSingleNode("Name")on that.