Hi, I've just started using XML. I have the following code that works against the following xml file.
My problrm is I can not read or get to the <location> value "Office" . The rest of the data (DCurrID and Dvalue) can be read out of the file and populate the listview as needed.
Any Ideas on how I can read the value fo <Location>
Thanks
Dan
Code:
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Table1>
<Location>Office</Location>
</Table1>
<Table1>
<Table1>
<DCurrID>15991</DCurrID>
<DValue>1</DValue>
</Table1>
<Table1>
<DCurrID>15991</DCurrID>
<DValue>2</DValue>
</Table1>
<Table1>
<DCurrID>15992</DCurrID>
<DValue>3</DValue>
</Table1>
<Table1>
<DCurrID>15993</DCurrID>
<DValue>6.45</DValue>
</Table1>
</NewDataSet>
Code:
Private Sub read_XML()
Try
Dim m_xmld As XmlDocument
Dim m_nodelist As XmlNodeList
Dim m_node As XmlNode
m_xmld = New XmlDocument
m_xmld.Load("C:\myXmlDoc.xml")
m_nodelist = m_xmld.SelectNodes("/NewDataSet/Table1")
For Each m_node In m_nodelist
Dim curridvalue = m_node.ChildNodes.Item(0).InnerText
Dim dvalue= m_node.ChildNodes.Item(1).InnerText
ListView1.Items.Add(curridvalue & " " & dvalue)
ListView1.Columns.Add("Col1", 500, HorizontalAlignment.Center)
ListView1.View = View.Details
Next
Catch errorVariable As Exception
Console.Write(errorVariable.ToString())
End Try
End Sub
My problrm is I can not read or get to the <location> value "Office" . The rest of the data (DCurrID and Dvalue) can be read out of the file and populate the listview as needed.
Any Ideas on how I can read the value fo <Location>
Thanks
Dan