using System;
using System.Xml;
class XmlTextReaderSample {
[STAThread]
static void Main(string[] args) {
XmlTextReader xmlTextReader = new XmlTextReader("sample.xml");
while (xmlTextReader.Read()) {
if (xmlTextReader.NodeType == XmlNodeType.Element) {
Console.Out.WriteLine((new String(' ', xmlTextReader.Depth * 3)) + "Name: <" + xmlTextReader.Name + ">; Depth: " + xmlTextReader.Depth.ToString() + "; Attributes count: " + xmlTextReader.AttributeCount.ToString() + ";");
}
}
}
}