.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

How to read Xml String in c#?

Posted By: chandrakant     Posted Date: February 24, 2011    Points:2   Category :C#
i want read the following xml string can please help ?


<root>
<disk>devicePath1</disk>
<disk>devicePath2</disk>
<disk>devicePath3</disk>
<volume>Volumeguidstring</volume>
<volume>Volumeguidstring</volume>
<drive>Volumeguidstring</drive>
</root>

Please Help.

Thanks in advance

Responses
Author: Manas Patnaik             
Posted Date: February 24, 2011     Points: 5   

I am not sure weather the XML is a valid one or not .But you can always parse the XML file using XMReader,XMLTextReader etc Under System.XMl.

XmlTextReader reader = new XmlTextReader ("your XML File Name.xml");
while (reader.Read())
{
// Your Logic.

}


There are other options also , refer http://msdn.microsoft.com/en-us/library/system.xml(v=vs.71).aspx


Manas Patnaik
http://manaspatnaik.com/blog
Author: Raga             
Posted Date: March 02, 2011     Points: 20   

Create an instance of XMLDocument xmldoc=new XMLDocument();
xmldoc.LoadXML(XML as string)
XMLdoc.selectsinglenode and so on..

Let me know if you need more inputs



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend