Solved

Parse XML file

Posted on 2006-10-20
4
202 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
4 Comments
 
LVL 9

Assisted Solution

by:daniel_balla
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;

Cheers!
Dani
0
 
LVL 2

Accepted Solution

by:
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();
    xD.Load(path);

    //use xml classes to perform methods

    return result;
}
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

759 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

21 Experts available now in Live!

Get 1:1 Help Now