W3C home > Mailing lists > Public > public-wai-ert@w3.org > July 2008

Differences between XPointer and Xpath expressions

From: Carlos Iglesias <carlos.iglesias@fundacionctic.org>
Date: Tue, 1 Jul 2008 17:14:44 +0200
Message-ID: <09700B613C4DD84FA9F2FEA52188281903CEBEEC@ayalga.fundacionctic.org>
To: <public-wai-ert@w3.org>

Hi group,

Following my last action item I was investigating the differences between both specifications, and this is what I came through:

The final conclusion could be something like: "Yes, the xpointer() scheme builds on the top of XPath"

A little bit of background for that conclusion (extracted from the xpointer() Scheme specification [1]):

"It [The Xpointer xpointer() scheme] is based on XPath, and adds the ability to address strings, points, and ranges in accordance with definitions provided in DOM 2: Range."

"The xpointer() scheme is built on top of the XML Path Language [...]. The xpointer() scheme's extensions to XPath add the ability to identify locations that are not single, whole elements (such as those corresponding to typical selections and selection points in some user interfaces), and to combine string matching with the other location methods provided."

"The prototypes for xpointer() scheme functions are given using the same notation used in the XPath Recommendation."

"This specification explicitly extends some aspects of the syntax and semantics of XPath (mainly in relation to support for locations other than whole nodes). Except in such cases, XPath constructs and definitions remain in effect in the xpointer() scheme"

Being the xpointer() Scheme Syntax:

xpointerschemedata ::= Expr

Expr is as defined in the XPath Recommendation, with the extensions defined in this specification.

Details of the XPointer extensions to XPath can be seen at [2]

Taking into consideration all the previous, I think that the best approach is to follow Michael's proposal: XPointer as a subclass of XPath. 

SinglePointer (ptr:reference)
'-ExpressionPointer (ptr:version, ptr:expression)
  '-XPathPointer (ptr:namespace)

Namespace (ptr:prefix, ptr:namespaceURI)

Regarding Johannes' concerns about the examples of XPointer that look different from the XPath ones, we can easily build them using the functions referenced at [2]. Some good examples from the specification:

string-range(//P,"Thomas Pynchon")[3],"P",1,0)

Finally, IMO when representing XPointer pointers, if we decide to focus solely on the xpointer() scheme, we should use only the scheme data for the pointer, as in the following example:

<ptr:XPointerPointer rdf:about="#xPointerPointer">
  <ptr:reference rdf:resource="http://example.org/doc1.html"/>  

Instead of using the complete scheme, as in the following one:

<ptr:XPointerPointer rdf:about="#xPointerPointer">
  <ptr:reference rdf:resource="http://example.org/doc1.html"/>  

This way we avoid any potential consistency problem between the ptr:reference (that is required) and the XPointer uri, and there shouldn't be any problem rebuilding the original expression as it is just: ptr:reference#xpointer(ptr:expression)

[1] - [http://www.w3.org/TR/xptr-xpointer/]
[2] - [http://www.w3.org/TR/xptr-xpointer/#terminology]



Carlos Iglesias

Fundación CTIC
Parque Científico-Tecnológico de Gijón
33203 - Gijón, Asturias, España
teléfono: +34 984291212
fax: +34 984390612
email: carlos.iglesias@fundacionctic.org
URL: http://www.fundacionctic.org 
Received on Tuesday, 1 July 2008 15:15:03 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:55:56 UTC