[xquery-talk] XQuery error codes and rewriting

John Snelson jsnelson at sleepycat.com
Thu Feb 2 13:29:35 PST 2006


David Carlisle wrote:
> http://www.w3.org/TR/xquery/#id-errors-and-opt
> says
> 
>     For a variety of reasons, including optimization, implementations
>     are free to rewrite expressions into equivalent expressions. Other
>     than the raising or not raising of errors, the result of evaluating
>     an equivalent expression must be the same as the result of
>     evaluating the original expression. 

Similarly, I have wondered about this clause in the XQuery spec. For 
instance, if I choose to rewrite "/" into "fn:root()" instead of 
"fn:root(self::node()) treat as document-node()", all I have changed is 
the error cases. The expression "/" now gives results in more cases than 
it did before (when the result is not a document node), and gives an 
alternate error code if the context item is undefined.

Is this acceptable? What if I rewrite an expression to give the same 
non-error answers, but complete gibberish when the spec says there 
should be an error - is that still conformant to the spec?

John

-- 
John Snelson, Berkeley DB XML Engineer
Sleepycat Software, Inc
http://www.sleepycat.com

Contracted to Sleepycat through Parthenon Computing Ltd
http://blog.parthcomp.com/dbxml


More information about the talk mailing list