[xquery-talk] Querying XSD

Michael Kay mike at saxonica.com
Wed May 11 05:25:53 PDT 2011


On 11/05/2011 12:22, Daniel Ebner wrote:
> Hi everyone!
>
> I'm currently looking for a xQuery Script that allows to query an XML 
> Schema file. I'm writing an XML-Editor that allows the user to mark up 
> text. When the user selects parts of the XML he/she should see all 
> possible Elements which he/sche can insert. I have the context of the 
> selection as a XPath. No I'm looking fpr an XQuery Script that querys 
> an XSD an gives back all possible children elements.
>
> Has anyone seen, tried, implemented  or  thought of somthing like this?
>
> Thanks Daniel
>

Working from raw schema documents is tricky, because you essentially 
have to reproduce all the logic of translating from the XML 
representation to the schema component model. It's better to work from 
the component model directly. Saxon's schema processor will generate an 
SCM file which is a rather literal XML dump of the schema components. It 
also includes a dump of the finite state machines for validating against 
complex types, which you might be able to take advantage of.

Michael Kay
Saxonica


More information about the talk mailing list