[xquery-talk] Reserved namespaces, and QNames as extension keywords

Michael Kay mike at saxonica.com
Tue Apr 21 00:54:19 PDT 2009

It's normal practice with namespaces to rely on the fact that if you use a
namespace based on a domain name that you own, then it's yours and other
people can't walk all over it. However, making a namespace "magic" in ways
other than the extensibility mechanisms defined in the spec is probably best

If you're going to invent syntactic extensions then user queries aren't
going to be interoperable across implementations at all, so qualifying such
extensions with namespaces seems to have very little benefit, other than
perhaps making a clash with future standardized language constructs less

Michael Kay

> -----Original Message-----
> From: talk-bounces at x-query.com 
> [mailto:talk-bounces at x-query.com] On Behalf Of Pavel Minaev
> Sent: 20 April 2009 23:30
> To: talk at x-query.com
> Subject: [xquery-talk] Reserved namespaces, and QNames as 
> extension keywords
> I have two questions regarding implementation conformance to 
> the XQuery spec.
> 1) The spec requires every module and schema to be associated 
> with a namespace, and seemingly doesn't restrict the value 
> domain for such namespaces (except for restricting clashes 
> between several modules/schemas imported within a single 
> query). Can an XQuery implementation go further than that, 
> and reserve specific namespaces for its own use, not allowing 
> programmer to define his modules and schemas within that 
> namespace at all? (but, e.g., providing some additional 
> predefined types available from such namespaces without any 
> "import schema" declarations).
> 2) Assuming the answer to #1 is true, is it legal for a 
> conforming XQuery implementation to use QNames from such a 
> reserved namespace as "keywords" (i.e. syntax elements for 
> extension language constructs), without fear of clashing with 
> future XQuery versions? I.e. something along the lines of:
>   declare namespace ext = "...";
>   declare variable $f
>   as ext:function(xs:integer, xs:integer => xs:integer) (* 
> custom type keyword *)
>   := ext:lambda($x as xs:integer, $y as xs:integer) as xs:integer { $x
> + $y } (* custom syntactic construct *)
> I am aware of pragmas and "declare option", but, obviously, 
> they are much more limited - in example above, ext:lambda 
> could possibly be a pragma, though that would complicate 
> nesting; but I don't see any way to use extensibility 
> mechanisms explicitly spelled out in XQuery spec for 
> something like ext:function.
> If the existing spec explicitly disallows such things, then I 
> would like to propose enabling them in future XQuery 
> versions; maybe with a new special construct to declare such 
> "extensibility" namespaces for extra clarity, e.g.:
>   declare extension namespace ext = "..."; 
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk

More information about the talk mailing list