Parse XML file

Posted on 2006-10-20
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#?
Question by:Rahamathulla_J
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

Assisted Solution

daniel_balla earned 125 total points
ID: 17772451
Hi Rahamathulla_J,

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

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


Accepted Solution

brazzle earned 125 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();

    //use xml classes to perform methods

    return result;

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

696 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