using System;
using System.IO;
using System.Xml;
public class Sample {
public static void Main() {
string xmlData =
@"
C#
5.95
";
// Create the reader.
XmlTextReader reader = new XmlTextReader(new StringReader(xmlData));
reader.WhitespaceHandling = WhitespaceHandling.None;
// Display each element node.
while (reader.Read()){
switch (reader.NodeType){
case XmlNodeType.Element:
Console.Write("<{0}>", reader.Name);
break;
case XmlNodeType.Text:
Console.Write(reader.Value);
break;
case XmlNodeType.EndElement:
Console.Write("{0}>", reader.Name);
break;
}
}
reader.Close();
}
}