using System;
using System.Xml;
public class Sample
{
public static void Main()
{
XmlReaderSettings settings = new XmlReaderSettings();
settings.IgnoreWhitespace = true;
using (XmlReader reader = XmlReader.Create("books.xml"))
{
// Moves the reader to the root element.
reader.MoveToContent();
// Moves to book node.
reader.Read();
Console.WriteLine("Read the first book using ReadInnerXml...");
Console.WriteLine(reader.ReadInnerXml());
Console.WriteLine("Read the second book using ReadOuterXml...");
Console.WriteLine(reader.ReadOuterXml());
}
}
}