public void abc()
{
StreamReader stream1 = new StreamReader("C:\\Inetpub\\wwwroot\\PR\\TreeNormal\\books.xml");
XmlTextReader reader = null;
reader = new XmlTextReader(stream1);
while (reader.Read())
{
// Do some work here on the data.
switch (reader.NodeType)
{
case XmlNodeType.Element: // The node is an Element.
Response.Write("<" + reader.Name); Response.Write(">
");
break;
case XmlNodeType.Text: //Display the text in each element.
Response.Write("
" + reader.Value);
break;
case XmlNodeType.EndElement: //Display end of element.
Response.Write("
");
break;
}
//Response.Write(reader.Name + " ");
}
while (reader.Read())
{
// Do some work here on the data.
//Console.WriteLine(reader.Name);
Response.Write(reader.Name);
}
}
No comments:
Post a Comment