Dim output As StringBuilder = New StringBuilder()
' XmlXapResolver is the default resolver.
Using reader As XmlReader = XmlReader.Create("book.xml")
' Moves the reader to the root element.
reader.MoveToContent()
reader.ReadToFollowing("book")
' Note that ReadInnerXml only returns the markup of the node's children
' so the book's attributes are not returned.
output.AppendLine("Read the first book using ReadInnerXml...")
output.AppendLine(reader.ReadInnerXml())
reader.ReadToFollowing("book")
' ReadOuterXml returns the markup for the current node and its children
' so the book's attributes are also returned.
output.AppendLine("Read the second book using ReadOuterXml...")
output.AppendLine(reader.ReadOuterXml())
End Using
OutputTextBlock.Text = output.ToString()