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)
If reader.HasAttributes Then
Console.WriteLine("Attributes of <" + reader.Name + ">")
Dim i As Integer
For i = 0 To reader.AttributeCount
reader.MoveToAttribute(i)
Console.Write(" {0}={1}", reader.Name, reader.Value)
Next i
reader.MoveToElement() 'Moves the reader back to the element node.
End If
End Sub
End Class