RE: Validating XPath queries

 
> 
>   Does anyone know of a tool that validates XPath queries 
> against XML schemas?  For a given schema, a query is valid if 
> there exists a document valid in the schema for which the 
> query returns at least one result.

Sure, Saxon-SA does this as part of schema-aware XSLT and XQuery processing,
and the functionality could be packaged to do what you are asking. Well, it
does almost this: Given an XPath expression and a schema type (typically a
complex type), Saxon will tell you whether the expression is capable of
selecting anything when applied to a context node of that type.
> 
>    I've seen mention on this list of XPath somehow 
> incorporated into XML Scheme 1.1.  Does that capability 
> obviate the value of such a tool?
> 

No, the fact that XSD uses XPath for defining assertions doesn't directly
help with your requirement.

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

Received on Friday, 15 May 2009 09:23:39 UTC