Solved

Read XML node

Posted on 2006-10-20
3
346 Views
Last Modified: 2010-04-23
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
0
Comment
Question by:nickmarshall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 125 total points
ID: 17773932
Try it with the InnerText property:

        Dim XmlDoc As New XmlDocument
        XmlDoc.Load("C:\Temp\Sample.xml")

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

        For Each node As XmlNode In lstNodes
            MessageBox.Show(node.InnerText)
        Next
0
 
LVL 18

Expert Comment

by:Ravi Singh
ID: 17773940
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)

0
 
LVL 18

Expert Comment

by:Ravi Singh
ID: 17773994
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:

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

0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question