XmlWriter.WriteNode copies data from the reader to the writer
Imports System
Imports System.IO
Imports System.Xml
public class Sample
public shared sub Main()
Dim reader as XmlTextReader = new XmlTextReader("books.xml")
reader.WhitespaceHandling = WhitespaceHandling.None
reader.MoveToContent()
reader.Read()
Dim writer as XmlTextWriter = 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()
end sub
end class
Related examples in the same category