[Webinar] Streamline your web hosting managementRegister Today


How to get a XML node by name

Posted on 2008-01-27
Medium Priority
Last Modified: 2012-06-21

I'd like to know how to get a XML node text using its name in ASP.NET, somehow like the javascript getElementById.

Thank you.
Question by:starusa
1 Comment

Accepted Solution

bele04 earned 2000 total points
ID: 20760689
You can use XPath to get the Node or list of nodes with the name that you want.

Sample if you have a XmlNode object with a couple of childnodes:

XmlDocument xd = new XmlDocument().Load("xml_file");
XmlNode xmlNode = xd.SelectSingleNode("/data");

if you want to get the data1 node you'd do something like this:

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

640 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