Home | Articles|Namespace|Interview Questions|Tools|Jobs|Projects|Community
Asp.net Tutorials

»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books

»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects

»Competition
Community
Winners
Prizes
Write For Us
Members

»Other Resources
Links
Dotnet Resources

Reading XML file in c#

This small article shows how to read a xml file in c#

We need the XmlTextReader class to read a xml file.

First create the xml file




first
second
third
fourth



save the above as test.xml in the BIN\DEBUG directory

using System.Xml;
string filename = "test.xml";

XmlTextReader xtr = new XmlTextReader(filename);

while(xtr.Read())
{
if(xtr.NodeType == XmlNodeType.Text)
System.Console.WriteLine(xtr.Value);
}

Have a Question and dont know the answer post it below and get answers in minutes

Due to spam this feature is disabled
To get answers fast , make sure you enter a detailed subject for example: "DataGrid issues need answer" not "DataGrid"

Subject:

Catjegory Name:

Message:



© 2008 dotnetwatch.com -- Privacy policy