Mega Code Archive
XmlReader Name Property gets the qualified name of the current node
Imports System
Imports System.IO
Imports System.Xml
Public Class Sample
Public Shared Sub Main()
Dim doc As New XmlDocument()
doc.Load("books.xml")
Dim nodeReader As New XmlNodeReader(doc)
Dim settings As New XmlReaderSettings()
settings.ValidationType = ValidationType.Schema
settings.Schemas.Add("urn:bookstore-schema", "books.xsd")
Dim reader As XmlReader = XmlReader.Create(nodeReader, settings)
reader.MoveToContent()
While reader.Read()
Select Case reader.NodeType
Case XmlNodeType.Element
Console.Write("<{0}>", reader.Name)
Case XmlNodeType.Text
Console.Write(reader.Value)
Case XmlNodeType.ProcessingInstruction
Console.Write("{0} {1}?>", reader.Name, reader.Value)
Case XmlNodeType.Comment
Console.Write("", reader.Value)
Case XmlNodeType.XmlDeclaration
Console.Write("")
Case XmlNodeType.Document
Case XmlNodeType.DocumentType
Console.Write("", reader.Name)
End Select
End While
End Sub
End Class