Mega Code Archive

 
Categories / VB.Net / XML
 

XPathNavigator Clone Method creates a new XPathNavigator positioned at the same node as this XPathNavigator

Imports System Imports System.Xml Imports System.Xml.XPath Public Class MainClass     Public Shared Sub Main()         Dim document As XPathDocument = New XPathDocument("books.xml")         Dim navigator As XPathNavigator = document.CreateNavigator()                  Dim nodes As XPathNodeIterator = navigator.Select("descendant::book[author/last-name='M']")                  While nodes.MoveNext()             Dim clone As XPathNavigator = nodes.Current.Clone()             clone.MoveToFirstChild()             Console.WriteLine("Book title: {0}", clone.Value)         End While     End Sub End Class