System.IO.StreamReader stream = new System.IO.StreamReader(@"D:\MyText.xml");
XmlTextReader reader = null;
reader = new XmlTextReader(stream);
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element: // The node is an Element.
Response.Write( reader.Name);
while (reader.MoveToNextAttribute()) // Read attributes.
Response.Write(" " + reader.Name + "='" + reader.Value + "'");
break;
case XmlNodeType.Text: //Display the text in each element.
Response.Write(reader.Value);
break;
case XmlNodeType.EndElement: //Display end of element.
Response.Write("" + reader.Name);
Response.Write(">");
break;
}
}