Imports System
Imports System.Xml
publicclass Sample
public shared Sub Main()
Using reader As XmlReader = XmlReader.Create("2books.xml")
reader.MoveToContent()
reader.ReadToDescendant("book")
reader.Skip() 'Skip the first book.
Do
Select Case reader.NodeType
Case XmlNodeType.Element
Console.Write("<{0}", reader.Name)
While reader.MoveToNextAttribute()
Console.Write(" {0}='{1}'", reader.Name, reader.Value)
End While
Console.Write(">")
Case XmlNodeType.Text
Console.Write(reader.Value)
Case XmlNodeType.EndElement
Console.Write("</{0}>", reader.Name)
End Select
Loop While reader.Read()
End Using
End Sub
End class