Reading an XML File


To Read the data present in xml file

Description


Reading an XML File


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

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


Explanation:
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


Comments

Author: Sunny Singh02 Feb 2013 Member Level: Bronze   Points : 0

Nice explanation. Thanks. Here's another simple approach to read xml file in asp.net http://www.freedotnetapps.com/asp-net/how-to-read-data-from-xml-file-in-asp-net/



  • 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:
    Email: