Download Source Code: Read XML Document with XPathNavigator
The .NET 2.0 XmlNavigator class provides a cursor model for navigating and editing XML data. This short article and download provide an introduction to using the XPathNavigator to read XML documents.
The download contains two examples: one that reads an XML document that contains a default namespace and one that reads and XML document that does not contain a default namespace.
An XPathNavigator object is created from a class that implements the IXPathNavigable interface such as the XPathDocument and XmlDocument classes.
' Declare a variable named theXPathNavigator of type XPathNavigator.
Dim theXPathNavigator As XPathNavigator
' Call the peopleXmlDocument object's CreateNavigator method
' assigning the resulting XPathNavigator object to theXPathNavigator variable.
theXPathNavigator = peopleXmlDocument.CreateNavigator
Click the link above to download Visual Basic source code in a Visual Studio 2005 solution which demonstrates how to use the XPathNavigator class to read XML documents.
Mike McIntyre