Link to home
Start Free TrialLog in
Avatar of nickmarshall
nickmarshall

asked on

Read XML node

Hi,

Within my XML file I have the following node;

<Type>Hardware</Type>

I would like to store "Hardware" from Type node as a string

How do I get this, I have attempted to do;

        Dim XmlDoc As New XmlDocument
        XmlDoc.Load(SourceFileName)

        Dim lstNodes As XmlNodeList = XmlDoc.GetElementsByTagName("Type")

        Dim node As XmlNode
        For Each node In lstNodes
            MessageBox.Show(node.ToString)
        Next
ASKER CERTIFIED SOLUTION
Avatar of Ravi Singh
Ravi Singh
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Note: I tested with the sample xml document, change the load statement to reflect your filename path again:

XmlDoc.Load("C:\Temp\Sample.xml")          to:

XmlDoc.Load(SourceFileName)

sorry, this question seems to be indirectly related to your previous asked question that is still open, if this doesnt work for you then you can close one of the two questions by requesting a close here:

https://www.experts-exchange.com/Community_Support/