Mega Code Archive

 
Categories / VB.Net / XML
 

XPathNavigator MoveToFirstAttribute

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.SelectDescendants("book", "", False)         While nodes.MoveNext()             Dim navigator2 As XPathNavigator = nodes.Current.Clone()             navigator2.MoveToFirstAttribute()             Console.WriteLine("{0} = {1}", navigator2.Name, navigator2.Value)                      While navigator2.MoveToNextAttribute()                 Console.WriteLine("{0} = {1}", navigator2.Name, navigator2.Value)             End While         End While     End Sub End Class