There is something I don't understand. From the saxon documentation:
Saxon allows you to write your own URIResolver to handle the URIs of
input documents, as defined in the JAXP 1.2 specification. Such a
URIResolver is used to process the URIs supplied to the doc() and
document() functions. It is also used to process the URIs supplied for
the source document and the stylesheet on the command line. In XSLT it
is used to process the URIs used in the xsl:include and xsl:import and
xsl:import-schema declarations, and in XQuery it supports the location
URIs in import module and import schema.
What I'm trying to do is put my modules/functions in a database and load
them when needed, exactly as stated in the last part of the last
sentence. Is there no way to do it in Saxon ?
Michael Kay wrote:
> Unfortunately query modules are not XML, and the JAXP URIResolver
> interface is only designed to handle XML. I've considered introducing
> my own kind of URIResolver here, but I thought I would wait and see
> what XQJ comes up with. This is partly because I want to wait and see
> what conventions emerge for handling the two module URIs (the one that
> identifies the module and the one that gives its location).
> If you have a URIResolver then it will be called for all URI schemes
> (=protocols). How you handle a non-standard scheme is entirely up to
> you (and/or the specification of the particular URI scheme). You can
> be as creative as you want, Saxon doesn't care.
> Michael Kay
> *From:* saxon-help-admin@...
> [mailto:saxon-help-admin@...] *On Behalf Of
> *Shay Artzi
> *Sent:* 05 August 2005 22:16
> *To:* saxon-help@...
> *Subject:* [Norton AntiSpam] [saxon] Custom URIResolver for XQuery
> I wrote a custom URIResolver and I'm attaching it to th configuration
> and the dynamic as follows
> Configuration config = new Configuration();
> config.setURIResolver(new MyURIResolver());
> final StaticQueryContext sqc = new StaticQueryContext(config);
> final DynamicQueryContext dynamicContext = new
> dynamicContext.setURIResolver(new MyURIResolver());
> When saxon tries to resolve a uri given to the doc function, my custom
> URI is being activated currectly. However, it is never activated for
> resolving the module URI
> Any ideas ?
> Second question: What do I need to do if I want the resolver to be
> called for protocols other than http://, https:// or file:// ?