It looks like you might be able to do something even simpler by calling
resolveMandatoryResource from within the ModuleURIResolver.  That way it
will resolve the import in the same way it resolves the endpoint xquery.

 

I can take a shot at writing a patch if you guys want.

 

From: J- MAN [mailto:[email protected]] 
Sent: Friday, July 29, 2011 11:29 AM
To: [email protected]
Subject: RE: Xquery endpoing with Import Module

 

You are right, after doing more research i discovered that saxon allows you
to define your own import module URI resolver to resolve the import
statements.  
All you have to do is implement it a ModuleURIResolver and set it with
staticQueryContext.setModuleURIResolver.

http://www.saxonica.com/documentation9.1/javadoc/net/sf/saxon/query/ModuleUR
IResolver.html

Can i submit a patch to camel-xquery that will allow urls like this:

                <camel:to
uri="xquery:com/test/xquery/manual.xq?moduleResolver=classpath"/>

And then imports will be resolved using absolute classpaths (must include
leading slash):

              import module namespace utils = "myutils" at
"/com/test/xquery/utils.xq"; 

This should only affect imports inside xquery files.



  _____  

Date: Fri, 29 Jul 2011 04:21:37 -0700
From: [email protected]
To: [email protected]
Subject: Re: Xquery endpoing with Import Module

camel-saxon will create a input stream to load the xquery file. 
I think it's more like saxon issue, saxon should support to load the 
file from class path. 

On 7/29/11 1:04 AM, jmandawg wrote: 


> Hi all, 
> 
> I'm trying to use an XQuery endpoint which looks like this: 
> 
> <camel:to uri="xquery:com/test/xquery/manual.xq"/> 
> 
> Where "com/test/xquery/manual.xq" is located in my "src/main/resources" 
> folder. 
> 
> When i try to put an import inside the manual.xq file like this: 
> 
> import module namespace utils = "myutils" at "utils.xq"; 
> 
> It cannot resolve the file.  If i give it a absolute uri to the file it
can 
> resolve it.  But the files need to live in my package. 
> 
> I'm running this inside servicemix. 
> 
> Thanks. 
> 
> -- 
> View this message in context:
http://camel.465427.n5.nabble.com/Xquery-endpoing-with-Import-Module-tp46433
85p4643385.html
> Sent from the Camel - Users mailing list archive at Nabble.com. 
> 



-- 
Willem 
---------------------------------- 
FuseSource 
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English) 
          http://jnn.javaeye.com (Chinese) 
Twitter: willemjiang 
Weibo: willemjiang 



  _____  

If you reply to this email, your message will be added to the discussion
below:

http://camel.465427.n5.nabble.com/Xquery-endpoing-with-Import-Module-tp46433
85p4646571.html 

To unsubscribe from Xquery endpoing with Import Module, click here
<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscrib
e_by_code&node=4643385&code=am1hbmRhd2dAaG90bWFpbC5jb218NDY0MzM4NXwtMTk3Njc2
ODA4OA==> . 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Xquery-endpoing-with-Import-Module-tp4643385p4648515.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to