Copies everything from the reader to the writer
using System; using System.IO; using System.Xml; public class Sample{ public static void Main(){ XmlTextReader reader = new XmlTextReader("books.xml"); reader.WhitespaceHandling = WhitespaceHandling.None; reader.MoveToContent(); reader.Read(); XmlTextWriter writer = new XmlTextWriter (Console.Out); writer.Formatting = Formatting.Indented; writer.WriteStartElement("myBooks"); writer.WriteNode(reader, false); reader.Skip(); writer.WriteNode(reader, false); writer.WriteEndElement(); writer.Close(); reader.Close(); } }