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

RE: the Canonical path of a node

  • From: Melvin Chin <mc@S...>
  • To: "Michael Kay" <mike@s...>, "'Philippe Poulard'" <Philippe.Poulard@s...>, "'David Carlisle'" <davidc@n...>
  • Date: Mon, 08 Jan 2007 23:42:56 +0800

RE:  the Canonical path of a node
At 01:08 PM 2007-01-08 +0000, Michael Kay wrote:
>It's a shame that XPath doesn't define a mechanism for binding
>prefixes within the expression itself. I think it would be a good idea if we
>could establish a conventional notation for an "augmented XPath expression":
>a string containing a set of namespace bindings and an XPath expression, and
>we could then encourage people to implement APIs that accept an "augmented
>XPath expression".

I fully agree.  Prefixes, being only aliases in XML standard, ought not 
become as
standard within XPath relative to namespace values as they are now.  What 
we need
is a standard way to refer to the namespace value without changing the logical
address referred to by a given XPath, even with prefixes are changed.


>  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.

I don't think, however, the XPointer syntax is useful either;  it is only 
hiding
the dust (prefixes) under the carpet (of predefining the prefixes with 
namespace
values, then followed by XPath).  I'd suppose a characteristic of a suitable
syntax would be such that it is as independent of prefixes as XML has 
defined it.

Another syntax I'd suggest, using your logical XPath point example above,
would be:

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

Advantage is clearly it is prefix-independent, follows closely XPath's style
of expressing pathways, and does not hijack space character.  Disadvantage
is certainly the length involved for long XPaths or long namespace values.
But I think I'm happier living with the latter.  I've seen it used somewhere,
but not sure if it has worked its way into some proposed standard or something.




cheers.



[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.