ARTICLE

.NET Beta 2 and Navigation in XML Documents

Posted by Dinesh Beniwal Articles | XML in VB.NET January 12, 2009
.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.
 
Reader Level:

.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 classes XPathDocument 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 .....

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor