You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jmandawg <jm...@hotmail.com> on 2011/07/28 19:04:07 UTC
Xquery endpoing with Import Module
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-tp4643385p4643385.html
Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Xquery endpoing with Import Module
Posted by jmandawg <jm...@hotmail.com>.
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/ModuleURIResolver.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: ml-node+4646571-592493739-235790@n5.nabble.com
To: jmandawg@hotmail.com
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-tp4643385p4643385.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-tp4643385p4646571.html
To unsubscribe from Xquery endpoing with Import Module, click here.
--
View this message in context: http://camel.465427.n5.nabble.com/Xquery-endpoing-with-Import-Module-tp4643385p4647400.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Xquery endpoing with Import Module
Posted by David Karlsen <da...@gmail.com>.
Could it be useful to have an spring implementation which follow their
Resource abstraction?
2011/7/30 jmandawg <jm...@hotmail.com>
>
> 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:jmandawg@hotmail.com]
> Sent: Friday, July 29, 2011 11:29 AM
> To: ml-node+4646571-592493739-235790@n5.nabble.com
> 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: ml-node+4646571-592493739-235790@n5.nabble.com
> To: jmandawg@hotmail.com
> 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.
--
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
Re: Xquery endpoing with Import Module
Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Jul 30, 2011 at 12:19 AM, jmandawg <jm...@hotmail.com> wrote:
> 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.
>
Yeah that would be great. We love contributions
http://camel.apache.org/contributing.html
>
>
> From: J- MAN [mailto:jmandawg@hotmail.com]
> Sent: Friday, July 29, 2011 11:29 AM
> To: ml-node+4646571-592493739-235790@n5.nabble.com
> 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: ml-node+4646571-592493739-235790@n5.nabble.com
> To: jmandawg@hotmail.com
> 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.
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Xquery endpoing with Import Module
Posted by Willem Jiang <wi...@gmail.com>.
We are always open and welcome the patches, that is how Apache works :)
Please create a JIRA and submit a patch with ASF license granted, I will
help you to apply it into the Camel trunk.
Willem
On 7/30/11 6:19 AM, jmandawg wrote:
> 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:jmandawg@hotmail.com]
> Sent: Friday, July 29, 2011 11:29 AM
> To: ml-node+4646571-592493739-235790@n5.nabble.com
> 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: ml-node+4646571-592493739-235790@n5.nabble.com
> To: jmandawg@hotmail.com
> 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
RE: Xquery endpoing with Import Module
Posted by jmandawg <jm...@hotmail.com>.
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:jmandawg@hotmail.com]
Sent: Friday, July 29, 2011 11:29 AM
To: ml-node+4646571-592493739-235790@n5.nabble.com
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: ml-node+4646571-592493739-235790@n5.nabble.com
To: jmandawg@hotmail.com
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.
Re: Xquery endpoing with Import Module
Posted by Willem Jiang <wi...@gmail.com>.
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-tp4643385p4643385.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
Re: Xquery endpoing with Import Module
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jul 28, 2011 at 7:04 PM, jmandawg <jm...@hotmail.com> 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.
What version of Camel and SMX are you using?
Does it work if you run it outside servicemix, such as from a plain junit test?
>
> Thanks.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Xquery-endpoing-with-Import-Module-tp4643385p4643385.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/