using System;
using System.Xml;
public class MainClass {
public static void Main(string[] args) {
XmlTextReader reader = new XmlTextReader(args[0]);
while (reader.Read()) {
switch (reader.NodeType) {
case XmlNodeType.Element: // The node is an Element
Console.WriteLine("Element: " + reader.Name);
while (reader.MoveToNextAttribute()) // Read attributes
Console.WriteLine(" Attribute: [" +
reader.Name + "] = '"
+ reader.Value + "'");
break;
case XmlNodeType.DocumentType: // The node is a DocumentType
Console.WriteLine("Document: " + reader.Value);
break;
case XmlNodeType.Comment:
Console.WriteLine("Comment: " + reader.Value);
break;
}
}
reader.Close();
}
}