Mega Code Archive
XPathNavigator ValueType Property gets the NET Framework Type of the current node
Imports System
Imports System.Xml
Imports System.Xml.XPath
Public Class MainClass
Public Shared Sub Main()
Dim settings As XmlReaderSettings = New XmlReaderSettings()
settings.Schemas.Add("http://www.domain.com/books", "domainBooks.xsd")
settings.ValidationType = ValidationType.Schema
Dim reader As XmlReader = XmlReader.Create("domainBooks.xml", settings)
Dim document As XPathDocument = New XPathDocument(reader)
Dim navigator As XPathNavigator = document.CreateNavigator()
navigator.MoveToChild("bookstore", "http://www.domain.com/books")
navigator.MoveToChild("book", "http://www.domain.com/books")
navigator.MoveToChild("price", "http://www.domain.com/books")
Console.WriteLine(navigator.ValueType)
Dim price As String = navigator.ValueAs(GetType(String))
Console.WriteLine(price)
End Sub
End Class