Say I have this Xml taken as an example:
To get the Xml text is:
How about if i add in one time tag...
How do i use the above node.ChildNodes method to get the "23" or "40" out from the Xml tag....
I need to loop through all the nodes...and I am using XmlDocument...
Any suggestion or link will be appreciated...
Thanks
VB.NET:
<Settings>
<Connection>
<UserID>sa</UserID>
<DataSource>Server</DataSource>
<InitialCatalog>Database</InitialCatalog>
</Connection>
</Settings>
VB.NET:
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
VB.NET:
<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>
I need to loop through all the nodes...and I am using XmlDocument...
Any suggestion or link will be appreciated...
Thanks
Last edited: