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.-->
<books>
<book>
<id>1</id>
<name>Photodex ProShow: Visual QuickStart Guide</name>
<author>Jon Canfield</author>
<price>$29.99</price>
<type>Photoshop</type>
</book>
</books>