[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: the Canonical path of a node

  • From: "Michael Kay" <mike@s...>
  • To: "'Michael Kay'" <mike@s...>,"'Philippe Poulard'" <Philippe.Poulard@s...>,"'David Carlisle'" <davidc@n...>
  • Date: Mon, 8 Jan 2007 13:26:58 -0000

RE:  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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.