XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] the Canonical path of a node

> One 
> candidate is the XPointer syntax:
> 
> xmlns(p1=http://p1.uri/) xmlns(p2=http://p2.uri/) 
> xmlns(p=http://p.uri)
> xpath2(/p1:a[1]/p2:b[1]/p:c[1])
> 
> This has a few drawbacks like not allowing the default 
> namespace to be declared, and requiring ")" and "^" to be 
> escaped as "^)" and "^^"; but at least it's defined in an 
> existing standard.
> > 

In fact I think a bigger drawback is that it would be nice for any syntax
for "augmented XPath expressions" to have the property that "every XPath
expression that does not use namespace prefixes is a valid augmented XPath
expression". This would allow existing APIs to be generalized more easily.

I think this can be achieved by a simpler syntax such as:

# xmlns:p1="http://p1.uri"; xmlns:p2="http://p2.uri"; xmlns:p="http://p.uri";
xmlns="xxx" #
/p1:a[1]/p2:b[1]/p:c[1]

Another candidate that meets this requirement is to use XQuery syntax

declare namespace p1="http://p1.uri";;
declare namespace p2="http://p2.uri";;
declare namespace p="http://p.uri";;
declare default element namespace"xxx";
/p1:a[1]/p2:b[1]/p:c[1]

but that seems rather verbose in the contexts where XPath is commonly used.

Another option I have considered in the past is to allow Clark-format URIs
in path expressions:

/{http://p1.uri}a[1]/{http://p2.uri}b[1]/{http://p.uri}c[1]

While this is much cleaner as a target syntax for machine-generated XPath
expressions, and is unambiguous in the XPath grammar, it unfortunately
clashes with XQuery's use of curly brackets.

Michael Kay
http://www.saxonica.com/



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS