camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Wolf <cwolf.a...@gmail.com>
Subject Re: Is the result of this builder reusable? XQueryBuilder.xquery("//foo");
Date Fri, 19 Apr 2013 21:24:58 GMT
Thanks Willem - that worked.

On Tue, Apr 2, 2013 at 10:33 PM, Willem jiang <willem.jiang@gmail.com> wrote:
> I think you can use the XQueryBuilder in the Processor just like you showed.
> If you want to call the evaluateAsString multiple times, you need to make sure the message
body is reread able.
> You can convert the message body into String before you process it in your processor.
>
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://www.fusesource.com | http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
>           http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
> On Tuesday, April 2, 2013 at 11:01 PM, Chris Wolf wrote:
>
>> I want to perform an XQuery outside of DSL (in a Processor). Something like:
>>
>> XQueryBuilder hostXQ = XQueryBuilder
>> .xquery("//remote[remoteId/@value='CBOE34']/server/@value");
>> String host = hostXQ.evaluateAsString(exchange);
>>
>> Second question is can I parameterize the XQuery like so:
>>
>> XQueryBuilder hostXQ = XQueryBuilder
>> .xquery("//remote[remoteId/@value=$accountId]/server/@value");
>>
>> hostXQ.setParameters(new HashMap<String, Object>() {{
>> put("accountId", "CBOE34");}});
>> String host1 = hostXQ.evaluateAsString(exchange);
>>
>> hostXQ.setParameters(new HashMap<String, Object>() {{
>> put("accountId", "CBOE78");}});
>> String host2 = hostXQ.evaluateAsString(exchange);
>>
>>
>> Thanks,
>>
>>
>> Chris
>
>

Mime
View raw message