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

XPointer Basics
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 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:
      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


    XPointer Basics - A Range Of Options


    (Page 6 of 8 )

    To the various node types defined in the XPath specification, XPointer adds two more: points and ranges.

    A point is defined as the address of a specific location within an XML document. It is identified by two characteristics: a container node and an index number. The container node is the node which encloses the point, while the index number is an integer which indicates the relative position of the point among the children of the container node.

    There are two types of points: node-points, which refer to XML elements, and character-points, which refer to the text contained within XML elements.

    The index number within a point definition differs in meaning depending on whether the point is a node-point or a character-point. In the case of a node-point, the index number references a specific child node or nested XML element; in the case of a character-point, it references a particular character of the text string.

    Points are defined with XPointer's start-point() and end-point() functions, both of which accept a location path (or collection of location paths) as argument.

    A range, defined as the area between two points, is created with the range() function, which returns a collection containing all the elements within the specified range.

    An example might help to make this clearer. Consider the following XML document:

    <?xml version="1.0"?> <movie id="67" genre="sci-fi"> <title>X-Men</title> <cast>Hugh Jackman, Patrick Stewart and Ian McKellen</cast> <director>Bryan Singer</director> <year>2000</year> <?play_trailer?> </movie>
    Now, the XPointer

    xpointer(range(/))
    would return a range covering the / element (the document element) and all those within it - in other words, a range covering the entire document.

    The start and end points of this range would be accessible via the XPointers

    xpointer(start-point(/))

    xpointer(end-point(/))
    and would point to the beginning and end of the document respectively.

    In a similar manner, the XPointer

    xpointer(range(//movie/title))
    would identify the range

    <title>X-Men</title>
    while the XPointer

    xpointer(start-point(//movie/director))
    would point to the location immediately preceding the "director" element.

    More XML Articles
    More By icarus, (c) Melonfire


     

       

    XML ARTICLES

    - 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...
    - SimpleXML
    - XForms Basics, Part 3
    - XForms Basics, Part 2
    - XForms Basics

     
    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 4 hosted by Hostway
    Stay green...Green IT