XPathNavigator.Select (String, IXmlNamespaceResolver)
Imports System
Imports System.Xml
Imports System.Xml.XPath
Public Class MainClass
Public Shared Sub Main()
Dim document As XPathDocument = New XPathDocument("domainBooks.xml")
Dim navigator As XPathNavigator = document.CreateNavigator()
Dim manager As XmlNamespaceManager = New XmlNamespaceManager(navigator.NameTable)
manager.AddNamespace("bk", "http://www.domain.com/books")
Dim nodes As XPathNodeIterator = navigator.Select("/bk:bookstore/bk:book/bk:price", manager)
If (nodes.MoveNext()) Then
Dim nodesNavigator As XPathNavigator = nodes.Current
Dim nodesText As XPathNodeIterator = nodesNavigator.SelectDescendants(XPathNodeType.Text, False)
While nodesText.MoveNext()
Console.WriteLine(nodesText.Current.Value)
End While
End If
End Sub
End Class
Related examples in the same category