Reading an XML File

To Read the data present in xml file


Reading an XML File

XmlTextReader tr = new XmlTextReader(Server.MapPath ("info.xml"));

while (tr.Read())
if (tr.NodeType == XmlNodeType.Text)
Response.Write (tr.Value);

The above code snippet helps to load data from XML file.
XmlTextReader object is used to read the data from XML file.
Using while loop read the text node content of xml file


Guest Author: 02 Feb 2013

Nice explanation. Thanks. Here's another simple approach to read xml file in

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: