XML
  Home arrow XML arrow Page 3 - XPointer Basics
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
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? 
Google.com  
XML

XPointer Basics
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2001-12-12


    Table of Contents:
  • XPointer Basics
  • The Need For XPointer
  • Revolving Around An Axis
  • Proof Of The Pudding
  • A Fragmented View
  • A Range Of Options
  • Asymmetrically Yours
  • Linking Up

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    XPointer Basics - Revolving Around An Axis
    ( Page 3 of 8 )

    Since the first component of a location step is the axis, let's deal with that first. An axis defines the relationship between the current node and the nodes to be selected - whether, for example, they are children of the current node, siblings of the current node, or the parent of the current node.

    The XPath specification defines the following axes:

    self - the "self" axis refers to the context node itself;

    parent - the "parent" axis selects the parent of the context node;

    child - the "child" axis selects the children of the context node;

    attribute - the "attribute" axis refers to the attributes of the context node;

    These are the most commonly-used ones; however, it's quite likely that you'll also find a use for:

    ancestor - the "ancestor" axis selects the parent, grandparent, great-grandparent and all other ancestors of the context node;

    descendant - the opposite of the "ancestor" axis, this axis selects the children (and children's children) of the context node;

    ancestor-or-self - this variant of the "ancestor" axis selects all ancestors of the context node as well as the node itself;

    descendant-or-self - this variant of the "descendant" axis selects all descendants of the context node as well as the node itself;

    following-sibling and preceding-sibling - these two axes contain the nodes at the same level in the document tree as the context node. Depending on which axis you use, you will get a collection of siblings which are either after or before the context node, in document order.

    following and preceding - the "following" axis selects all nodes within the document tree which follow (are placed after) the context node, while the "preceding" axis selects all nodes which come before the context node.

    namespace - the "namespace" axis selects all the nodes in the same namespace as the context node;

    Once the relationship to be established has been defined and an appropriate node collection obtained, a node test can be used to further filter the items in the collection. This node test is connected to the axis by a double colon (::) symbol.

    Typically, you would select a node on the basis of its name without using a node test; in such a case, the node type is deduced from the axis part of the location step. If, on the other hand, you'd like to select nodes on the basis of type, XPath offers some pre-defined node tests; the text() node test selects text nodes, the comment() function selects comments, the processing-instruction() function selects PIs and the generic node() function selects any and all nodes.

    Finally, in case the resulting collection needs to be further broken down, XPath allows you to add optional predicates to each location step, enclosed within square braces.

     
     
    >>> More XML Articles          >>> More By icarus, (c) Melonfire
     

       

    XML ARTICLES

    - Flex Array Collection Sort and Filtering
    - The Flex Tree Control
    - Flex List Controls
    - Working with Flex and Datagrids
    - How to Set Up Podcasting and Vodcasting
    - Creating an RSS Reader Application
    - Building an RSS File
    - An Introduction to XUL Part 6
    - An Introduction to XUL Part 5
    - An Introduction to XUL Part 4
    - An Introduction to XUL Part 3
    - An Introduction to XUL Part 2
    - An Introduction to XUL Part 1
    - XML Matters: Practical XML Data Design and M...
    - Practical XML Data Design and Manipulation f...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek