?
Solved

Parse XML file

Posted on 2006-10-20
4
Medium Priority
?
243 Views
Last Modified: 2010-04-16
I have a task like

sent xml file to a method() and parse the xml file inside the method to get the tag value for further process how can i do that in c#?
0
Comment
Question by:Rahamathulla_J
[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
4 Comments
 
LVL 9

Assisted Solution

by:daniel_balla
daniel_balla earned 375 total points
ID: 17772451
Hi Rahamathulla_J,

XmlDocument xDoc = new XmlDocument();
xDoc.Load("your file path here");

string yourTagValue = xDoc.SelectSingleNode("your XPath").InnerText;

Cheers!
Dani
0
 
LVL 2

Accepted Solution

by:
brazzle earned 375 total points
ID: 17774203
or if you wish to create a class to encapsulate the process you can do this:

public string ParseXML(string path, string tag)
{
    XmlDocument xD = new XmlDocument();
    xD.Load(path);

    //use xml classes to perform methods

    return result;
}
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
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
Course of the Month12 days, 13 hours left to enroll

777 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