Hi I have xmlFile like below .My problem is that I cant iterate through all nodes.I have tried something like this .But I think its to diffucult for me .I am so cunfused.How can do this without Linq To Xml

protected void Page_Load(object sender, System.EventArgs e)
        string xmlFile = Request.PhysicalApplicationPath + @"myxml.xml";
        XmlReaderSettings settings = new XmlReaderSettings();
        settings.IgnoreComments = true;
        settings.IgnoreWhitespace = true;

        using (XmlReader reader = XmlReader.Create(Server.MapPath("myxml.xml"), settings)) {
            while (reader.Read()) {
                string xmlContent = "";
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "Book") {

                    while (reader.NodeType != XmlNodeType.EndElement)

                    Label1.Text = xmlContent;




<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--This is sample book store xml file.-->
    <name>Photodex ProShow: Visual QuickStart Guide</name>
    <author>Jon Canfield</author>


I think that this is the simplest way to do this.

List<string> list=new List<string>();
XmlDocument doc = new XmlDocument();
                doc.Load("string path or url");
                XmlNodeReader nodereader = new XmlNodeReader(doc);
                while (nodereader.Read())
                    if (nodereader.NodeType == XmlNodeType.Element)
            foreach (string node in list) 


if you .xml file is located on your hard drive than use the OpenFileDialog class otherwise if it s on the web that put your url as a string.

This article has been dead for over six months. Start a new discussion instead.