XPointer frameworks is used as basis of fragment identifiers with media type of text/html, application/xml, text/xml-external-parsed-entity or application/xml-external-parsed-entity. XPointer frameworks is collection of schemes which specifie how to address elements in an XML tree. Frameworks include :

  • XPath functions
  • XPointer functions
  • xmlns() scheme
  • element() scheme
  • xpointer() scheme
  • external party schemes.

W3C encourages including identifiers for other media types and to define own scheme for XPointer frameworks.

Frameworks

XPointer framework specification says name of the elements can be used following ‘#’ sign to point to the element of the document.

Example of XPointer framework

The example refers to the “cricket” element in http://www.sportsdayevent.xml.

<?xml version=”1.0”?>

<sports xmlns:xlink=”http://www/w3/org/TR/xlink/”>   

<game xlink:type=”simple” xlink:href=” http://www.sportsdayevent.xml#cricket” xlink:show=”new”>Cricket</game>

…..

</sports>

The element() scheme

The element scheme was developed to make XPointer easy to implement. The id to be searched is passed in element() to find its reference. But the id has to be declared in XML schema or DTD. Apart from id, location steps can be added by using numbers to pick up child elements.They are referred using element(id/number[1-9]).

Examples of element() scheme

xlink:href = http://www.sportsdayevent.xml#element(/1/4)”

This refers to the 4 child element inside root element.

xlink:href = http://www.sportsdayevent.xml#element(cricket/1/4)”

Second example indicates fourth child element inside the first child element of the ‘id’ cricket.

The example below refers to the “football” id in http://www.sportsdayevent.xml

<?xml version=”1.0”?>

<sports xmlns:xlink=”http://www/w3/org/TR/xlink/”>   

<game xlink:type=”simple” xlink:href=” http://www.sportsdayevent.xml#element(football)” xlink:show=”new” > Football</game>

…..

</sports>

The xmlns() scheme

The XML namespace scheme points to the data present within a namespace. It does not locate any resource but simply declares the namespace context for the succeeding pointer parts to be evaluated.

Example of xmlns() scheme

The example refers to namespace “xgm” and the further pointers are pointed to the id “football ” is within the namespace “xgm”.

<?xml version=”1.0”?>

<sports xmlns:xlink=”http://www/w3/org/TR/xlink/”>   

<game xlink:type=”simple” xlink:href=” http://www.sportsdayevent.xml#xmlns(xgm=http://sportsset.xml)xgm:football” xlink:show=”new”>Football</game>

…..

</sports>

The xpointer() scheme

The xpointer scheme uses XPath expression to point to a location.

Example of xpointer() scheme

The example below points to the last player in data/team1/player

<?xml version=”1.0”?>

<sports xmlns:xlink=”http://www/w3/org/TR/xlink/”>   

<game xlink:type=”simple” xlink:href=” http://www.sportsdayevent.xml#xpointer(/data/team1/player[last()]

)” xlink:show=”new”>Football</game>

…..

</sports>

 

›› go to examples ››