[Home] [By Thread] [By Date] [Recent Entries]


Rick Jelliffe wrote:

From: "Jonathan Robie" <jonathan.robie@d...>

> >The idea that a query system can optimise away, or generate errors on,
> >queries like aaa/bbb if the schema specifies that aaa has no bbb children
> >is also very worrying.
>
> Indeed.
>
> Whether or not that is an error is currently an open issue in XQuery. My
> own view is that it should be neither a static nor a dynamic error, but
> that it should evaluate to an empty sequence.

[[
Is that right? There is no way to say "Tell me what is in the document"
if some schema has deemed something impossible.  How the hell can
anyone validate documents-in-progress (which may well be invalid)
using that?
]]

This isn't as bad as you think. One very reasonable interpretation of:

aaa/bbb

when the schema says this is 'disallowed', indeed that the node list
returned by such an XPath will always be null -- without needing to look at
any particular instance of a document meeting the constraints expressed in
the schema.

So a clever XPath 2 implementation could, I suppose "compile" the "aaa/bbb"
path into a null list (ala constant evaluation).

A Schematron assertion (that the node list is non-null) would then always
fail, even at "compile" time.

I think this behavior would be _better_ for Schematron. This behavior is
expected when you treat a "type" as defining a set of nodes, and why I've
said that XPath 1.0 -today- is viewed as such a type system.

Jonathan


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member