[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|