You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by smilin <sm...@gmail.com> on 2015/03/25 06:33:55 UTC
Xquery Transform using camel
When i try to do
from("direct:start")
.transform(xquery("<Name>{/bookstore/book[1]/author/text()}</Name>"));,
it give the expected result <Name>Giada De Laurentiis</Name>
But when i try with loop condition as below
from("direct:start")
.transform(xquery("<BookList>{for $x at $i in /bookstore/book return
<book>{bookstore/book[{$i}]/title/text()}</book>}</BookList>"));
I throw error on line 1 column 73
XPST0003 XQuery syntax error near #...turn <book>'{bookstore/book[{$#:
Unexpected token "{" in path expression
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: <?xml version="1.0"
encoding="UTF-8"?>
If i remove braces print reponse as
"<BookList><book>bookstore/book[1]/title/text()</book><book>bookstore/book[2]/title/text()</book><book>bookstore/book[3]/title/text()</book><book>bookstore/book[4]/title/text()</book></BookList>"
Is there a way i can execute this for condition "{for $x at $i in
/bookstore/book return <book>{bookstore/book[{$i}]/title/text()}</book>}"
through camel xquery API
Thank you!
--
View this message in context: http://camel.465427.n5.nabble.com/Xquery-Transform-using-camel-tp5764730.html
Sent from the Camel Development mailing list archive at Nabble.com.
Re: Xquery Transform using camel
Posted by Christian Müller <ch...@gmail.com>.
Please use the user mailing list / user forum for such kind of questions.
Best,
Christian
Am 25.03.2015 06:34 schrieb "smilin" <sm...@gmail.com>:
> When i try to do
> from("direct:start")
>
> .transform(xquery("<Name>{/bookstore/book[1]/author/text()}</Name>"));,
> it give the expected result <Name>Giada De Laurentiis</Name>
>
> But when i try with loop condition as below
>
> from("direct:start")
> .transform(xquery("<BookList>{for $x at $i in /bookstore/book
> return
> <book>{bookstore/book[{$i}]/title/text()}</book>}</BookList>"));
>
> I throw error on line 1 column 73
> XPST0003 XQuery syntax error near #...turn <book>'{bookstore/book[{$#:
> Unexpected token "{" in path expression
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange: Exchange[Message: <?xml version="1.0"
> encoding="UTF-8"?>
>
> If i remove braces print reponse as
>
> "<BookList><book>bookstore/book[1]/title/text()</book><book>bookstore/book[2]/title/text()</book><book>bookstore/book[3]/title/text()</book><book>bookstore/book[4]/title/text()</book></BookList>"
>
> Is there a way i can execute this for condition "{for $x at $i in
> /bookstore/book return <book>{bookstore/book[{$i}]/title/text()}</book>}"
> through camel xquery API
>
> Thank you!
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Xquery-Transform-using-camel-tp5764730.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>