Home arrow XML arrow Page 2 - XPointer Basics

The Need For XPointer - XML

You already know how to link XML documents together with XLink, and isolate specific nodes or node collections with XPath. Now uncover the third and final piece of the XML linking jigsaw - XPointer, an experimental technology from the W3C, which allows you to create XML links to specific points or ranges within an XML document.

TABLE OF CONTENTS:
  1. XPointer Basics
  2. The Need For XPointer
  3. Revolving Around An Axis
  4. Proof Of The Pudding
  5. A Fragmented View
  6. A Range Of Options
  7. Asymmetrically Yours
  8. Linking Up
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 2
December 12, 2001

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
XPointer evolved as part of the work of the W3C's XML Linking Working Group, which is also responsible for XLink. While developing XLink, the Working Group realized the necessity of a language to address specific nodes - elements or character data - or sets of nodes within an XML document.

This wasn't the only requirement, however - the XML Linking Working Group also identified the following requirements of such a language:

1. XPointers should be based on "descriptive links" - links which identify locations by their context.

2. XPointers should be easy to read and understand; they should also be simple to interpret for browsers and Web servers.

3. It should be possible to create an XPointer for any specific point in a document. Similarly, it should also be possible to create an XPointer that identifies a specific range of data within an XML document.

4. XPointers should include the capability to restrict node selections on the basis of user-imposed constraints, in much the same way as XPath uses predicates.

5. Minor changes to an XML document - changes in whitespace, line breaks and formatting - should not "break" an XPointer.

XPath already existed to meet some of these requirements; however, it is primarily intended for use with XSLT rather than XML links, and therefore does not address some of the more specialized items in the list above.{mospagebreak title=First Steps} Let's look at XPath quickly, and then proceed to XPointer proper.

XPath makes it possible to locate a node, or set of nodes, at any level of an XML document tree, using a thingamajig known as a "location path."

A location path may be either an absolute path, which expresses a location with reference to the root node, or a relative path, which expresses a location with reference to the current node (since this location is always in context to something else, it is also referred to as the "context node"). Location paths are made up of a series of "location steps", each identifying one level in the XPath tree and separated from each other by a forward slash (/).

A location step can be further broken down into three components: there's an "axis", which defines the relationship to use when selecting nodes; a "node test", which specifies the types of nodes to select; and optional "predicates" to filter out unwanted nodes from the resulting collection (I'll explain each of these in detail further down so that they become a little less frightening.)

The syntax of a location step is as follows

axis::node-test[predicates]


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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

XML ARTICLES

- Google Docs and Xpath Data Functions
- 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...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: