XmlReader.GetAttribute gets the value of the attribute with the specified index.
Imports System
Imports System.IO
Imports System.Xml
Public Class Sample
Public Shared Sub Main()
' Create the XmlNodeReader object.
Dim doc As New XmlDocument()
doc.Load("books.xml")
Dim nodeReader As New XmlNodeReader(doc)
' Set the validation settings.
Dim settings As New XmlReaderSettings()
settings.ValidationType = ValidationType.Schema
settings.Schemas.Add("urn:bookstore-schema", "books.xsd")
' Create a validating reader that wraps the XmlNodeReader object.
Dim reader As XmlReader = XmlReader.Create(nodeReader, settings)
reader.ReadToFollowing("book")
Dim isbn As String = reader.GetAttribute(2)
End Sub
End Class