Page 1 of 1

custom URI resolvers in Saxon XQuery

Posted: Thu Nov 17, 2005 1:54 am
by mmcsweeny
Is there a way to install a custom URI resolver for use in Saxon XQuery? I would like to achieve the equivalent of using the Saxon command line argument '-r', but within the context of an oXygen session.

Thanks,

Mark

Posted: Thu Nov 17, 2005 12:29 pm
by sorin_ristache
Hello,

In the next version the XQuery transformer of <oXygen/> will have a catalog resolver set as URI resolver. It will resolve URI references to local files using mappings that you can configure in an XML catalog in the same way as for XSLT transformations.

Regards,
Sorin

Posted: Thu Nov 17, 2005 5:47 pm
by mmcsweeny
Thanks for the info. Let me say more about my requirement.

I want to be able to implement custom URI schemes to allow access to resources other than those in local files or on the web. For example, an "sql:" scheme that would reach into SQL databases or a "jtidy:" scheme that would allow messy HTML pages to be accessed. I want to be able to install custom URI resolvers that perform these functions.

In stock Saxon (and other XQuery processors), I can install such URI resolvers using the Java API or by means of the "-r" command line option. So, I am looking for an equivalent capability in the context of an oXygen session. My motivation is so that I can edit and test my XQuery files directly in oXygen instead of having to use an external processor. This will become especially useful once oXygen has an XQuery debugger.

Thanks again,

Mark

XML Catalog support ready,but you need a custom proto plugin

Posted: Thu Nov 17, 2005 6:08 pm
by sorin_ristache
Hello Mark,

We added already XML catalog support for XQuery transforms and it will be available starting with the next release of <oXygen/>. But that will not solve your custom URL scheme problem because you do not have direct access to Saxon in order to set a custom URI resolver. If you want to load the data processed in the XQuery transform from a non standard URL like sql: or jtidy: you will have to write a custom protocol plugin in Java for the standalone distribution of <oXygen/> for the custom URL schemes. The plugin will handle the loading and saving of data from/to the non standard URLs. Basically you will have to implement a Java interface with one method. From that method you have to return an extension of java.net.URLStreamHandler. This allows you to load/save from/to a custom URL through the URLStreamHandler.openConnection(java.net.URL) method. This works only for the standalone distribution of <oXygen/>.

Best regards,
Sorin

Posted: Thu Nov 17, 2005 8:30 pm
by mmcsweeny
Thanks for your quick response. Are you referring to Java's URLStreamHandlerFactory mechanism? If so, then I know what to do.

If not, then can you point me to some documentation about custom protocol plugins? I checked the oXygen plugin documentation, but it does not mention them.

Thanks,

Mark

Just wait for the next <oXygen/> release

Posted: Fri Nov 18, 2005 9:40 am
by sorin_ristache
Hello Mark,
mmcsweeny wrote:Are you referring to Java's URLStreamHandlerFactory mechanism? If so, then I know what to do.
Yes.
mmcsweeny wrote:I checked the oXygen plugin documentation, but it does not mention them.
That article will be updated and the User Manual will document also the improved plugin support for <oXygen/> standalone added by the next version. Both the article and the User Manual will be updated on the website together with the next release of <oXygen/>.

Regards,
Sorin

Posted: Sat Nov 19, 2005 7:08 pm
by mmcsweeny
Thanks for all your help.

Cheers,

Mark

Posted: Thu Jan 19, 2006 1:48 pm
by sorin_ristache
Hello,

<oXygen/> version 7.0 was released and it supports custom protocol plugins using the described mechanism.

Regards,
Sorin