custom URI resolvers in Saxon XQuery

Oxygen general issues.
mmcsweeny
Posts: 4
Joined: Thu Nov 17, 2005 1:44 am

custom URI resolvers in Saxon XQuery

Post 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
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post 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
Last edited by sorin_ristache on Thu Jan 19, 2006 1:22 pm, edited 1 time in total.
mmcsweeny
Posts: 4
Joined: Thu Nov 17, 2005 1:44 am

Post 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
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

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

Post 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
mmcsweeny
Posts: 4
Joined: Thu Nov 17, 2005 1:44 am

Post 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
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Just wait for the next <oXygen/> release

Post 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
mmcsweeny
Posts: 4
Joined: Thu Nov 17, 2005 1:44 am

Post by mmcsweeny »

Thanks for all your help.

Cheers,

Mark
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

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

Regards,
Sorin
Post Reply