[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Relative URIs in namespaces

Michael Kay mike at saxonica.com
Sat Aug 29 16:30:56 PDT 2009


  Relative URIs in namespaces
> So far as I can see, there's nothing restricting the use of 
> such namespaces in the spec: "foo" in above code sample is an 
> UriLiteral, and portable XQuery code must ensure that it is 
> in the lexical namespace of xs:anyURI; and the latter 
> explicitly allows for relative references, which this one is.

Correct.
> 
> However, it is not clear to me what should happen when the 
> output is mapped to XML Infoset. The spec for the latter states rather
> unambiguously:
> 
> "Furthermore, this specification does not define an 
> information set for documents which use relative URI 
> references in namespace declarations."

If you try to create a document with relative URIs as namespaces and then
convert it to something that doesn't allow relative URIs (XOM is an
example), you will get an error.

Generally, the QT specs decided to be permissive about what a namespace URI
can contain. The reason for that is that the history of other relevant specs
makes it very unclear what's allowed and what isn't. For example, the first
edition of the Namespaces Rec did not even require that the namespace should
be a legal URI: it uses the phrase "The attribute's value, a URI reference,
is the namespace name identifying the namespace" but nowhere says that it is
an error (or that the document is not namespace-well-formed) if the
namespace name is not a legal URI reference. This was fixed in the second
edition, which says "The attribute's normalized value MUST be either a URI
reference - the namespace name identifying the namespace - or an empty
string.". Equally, the XSD specs have been very unclear about what the legal
values of an anyURI (and hence a QName, and hence a namespace) are - in XSD
1.1, an xs:anyURI can contain any sequence of Unicode characters.

So, the whole area is very messy. If you're choosing namespaces, play safe
and use a legal absolute URI. If you're writing an XQuery processor, play
safe and allow any character string.

Regards,

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



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
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-2011 All Rights Reserved.