.NET Beta 2 and Navigation XML Documents in VB.NET

.NET Beta 2 was released yesterday at tech-ed, 2001, Atlanta. Many things have been changed in Beta 2 since Beta 1. In this article, I'll cover changes in XmlNavigator class replaced with XPathNavigator.
  • 2065

.NET Beta 2 was released at tech-ed, 2001, Atlanta. Many things have been changed in Beta 2 since Beta 1. In this article, I'll cover changes in XmlNavigator class replaced with XPathNavigator.

XmlNavigator Class

XmlNavigator class is used to navigate an XML document in Beta 1. I was revising XML.NET chapter of my Beta 1 based code and found XmlNavigator class unavailable. The new class appreared in Beta 2 is XPathNavigator. You use two classes to navigate through XML documents - these classesXPathDocument and XPathNavigator

The XPathDocument class provides a fast cache for XML document processing using XSLT and XPath.You use XPathDocument constructor to create an instance of XmlPathDocument. Constructor has various overridables. You can pass an XmlReader, TextReader, or even direct XML file names. For example:

Dim xmlDoc As XmlPathDocument =  New XmlPathDocument("C:\\XmlDataDoc.xml")

XPathNavigator Class

The XPathNavigator class implements the functionality to navigate through a document. It has easy to use and self-explanatory methods. You create XPathNavigator instance by calling XPathDocument's CreateNavigator method.

Dim navigator As XPathNavigator =  xmlDoc.CreateNavigator()

XPathNavigator Move Methods

XPathNavigator provides enough methods to traverse through a document as a tree. Some of these methods are MoveToFirst, MoveToLast, MoveToId, MoveToRoot, MoveToNext, MoveToPrevious, MoveToParent .....

 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.