Mega Code Archive
XPathNavigator SelectAncestors selects all the ancestor nodes of the current node with local name and namespace URI
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()
navigator.MoveToChild("bookstore", "http://www.domain.com/books")
navigator.MoveToChild("book", "http://www.domain.com/books")
Dim bookDescendants As XPathNodeIterator = navigator.SelectDescendants("", "http://www.domain.com/books", False)
Console.WriteLine("Descendant nodes of the book node:")
While bookDescendants.MoveNext()
Console.WriteLine(bookDescendants.Current.Name)
End While
End Sub
End Class