Solved

Read XML node

Posted on 2006-10-20
3
338 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
  • 3
3 Comments
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

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 …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now