Say I have this Xml taken as an example:
Code:
<Settings>
<Connection>
<UserID>sa</UserID>
<DataSource>Server</DataSource>
<InitialCatalog>Database</InitialCatalog>
</Connection>
</Settings>
To get the Xml text is:
Code:
Dim m_xmld As XmlDocument
Dim m_nodelist As XmlNodeList
Dim m_node As XmlNode
m_xmld = New XmlDocument()
m_xmld.Load("Settings.xml")
m_nodelist = m_xmld.SelectNodes("/Settings/Connection")
For Each m_node In m_nodelist
Dim UserID = m_node.ChildNodes.Item(0).InnerText
Dim DataSource = m_node.ChildNodes.Item(1).InnerText
Dim InitialCatalog = m_node.ChildNodes.Item(2).InnerText
Next
How about if i add in one time tag...
Code:
<Settings>
<Connection>
<UserID>sa</UserID>
<DataSource>Server</DataSource>
<InitialCatalog>Database</InitialCatalog>
<Register>
<Time hour="23" min=40">
<Date>22/10/78</Date>
</Register>
</Connection>
<Connection>
<UserID>sa</UserID>
<DataSource>Server</DataSource>
<InitialCatalog>Database</InitialCatalog>
<Register>
<Time hour="23" min=40">
<Date>22/10/78</Date>
</Register>
</Connection>
</Settings>
Right now, there is one more Childnodes and Subchild in the Register and Time tag...
How to create a loop to get the "23" or "40" plus the DataSource out from the Xml tag using the above ChildNodes method....
I need to loop through all the nodes...and I am using XmlDocument...
Any suggestion or link will be appreciated...
Thanks