.NET
  Home arrow .NET arrow Page 4 - Working with XPath: The .NET Way
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Working with XPath: The .NET Way
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 24
    2005-11-01

    Table of Contents:
  • Working with XPath: The .NET Way
  • What is inside XPath?
  • XPath with a simple example
  • XPath related classes in .NET
  • Examining XPath with a simple VB.NET/C# example

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Working with XPath: The .NET Way - XPath related classes in .NET


    (Page 4 of 5 )

    .NET framework provides full support to XML with the “System.XML” namespace.  If we need to work with XPath, the following classes would be a bit helpful:

    • XPathNavigator
    • XPathNodeIterator
    • XPathExpression
    • XPathDocument
    • XPathException

    The “XPathNavigator” class allows you to define a read-only, random access cursor on a data store. The “XPathNodeIterator” class enables you to iterate a set of nodes that you select by calling an XPath method. The “XPathExpression” class encapsulates a compiled XPath expression. An XPathExpression object is returned when you call the Compile method. The Select, Evaluate, and Matches methods use this class. The “XPathDocument” class provides a read-only cache for fast and highly optimized processing of XML documents using XSLT. “XPathException” is the exception that is thrown when an error occurs during the processing of an XPath expression.

    Apart from the above, there exists one more interface, “IXPathNavigable”.  This interface enables you to create an XPathNavigator class. The classes that implement this interface enable you to create navigators using the CreateNavigator method.

    To create an XPathNavigator object for an XML document, you use the CreateNavigator method of the XmlNode and XPathDocument classes, which implements the IXPathNavigable interface. The CreateNavigator method returns an XPathNavigator object. You can then use the XPathNavigator object to perform XPath queries. You can use XPathNavigator to select a set of nodes from any data store that implements the IXPathNavigable interface. A data store is the source of data, which may be a file, a database, an XmlDocument object, or a DataSet object. You can also create your own implementation of the XPathNavigator class that can query other data stores.

    The XPathNavigator object reads data from an XML document by using a cursor that enables forward and backward navigation within the nodes. In addition, XPathNavigator provides random access to nodes. However, because the cursor that the XPathNavigator object uses is read-only, you cannot edit an XML document by using the XPathNavigator object.

    More .NET Articles
    More By Jagadish Chaterjee


       · get in touch with XPath now. any doubts...do not hesitate to post them
       · Simple and easy explaination of the concepts.
     

    .NET ARTICLES

    - Using CrystalReportViewer to Display Crystal...
    - Creating Summary .Net Crystal Reports
    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT