You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Martin Stiborský <ma...@gmail.com> on 2013/01/23 23:25:36 UTC

Filtering XML exchange body content

Hello guys,
is it possible with standard Camel weapons, to filter XML body with XPath
to contain only selected data?
I tried various combination of .setBody(), .XPath() and filter().
I believe the solution needs .setBody(), but I can't find the correct
solution.

Thanks!

-- 
S pozdravem / Best regards
Martin Stiborský

Jabber: stibi@njs.netlab.cz
Twitter: http://www.twitter.com/stibi

Re: Filtering XML exchange body content

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jan 24, 2013 at 8:40 AM, David Karlsen <da...@gmail.com> wrote:
> Maybe try an xslt transform?
> Den 23. jan. 2013 23:26 skrev "Martin Stiborský" <ma...@gmail.com>
> følgende:
>

Yeah xslt would work.

But I assume you can also do

<transform>
   <xpath>/foo/bar</xpath>
</transform>

To transform the message using the xpath expression.

Mind that with xpath, then namespaces is tricky and if your XML has namepaces,
then you must use them in the xpath expression also. Or use some trick
with local_xxx stuff. I can't remember its syntax.




>> Hello guys,
>> is it possible with standard Camel weapons, to filter XML body with XPath
>> to contain only selected data?
>> I tried various combination of .setBody(), .XPath() and filter().
>> I believe the solution needs .setBody(), but I can't find the correct
>> solution.
>>
>> Thanks!
>>
>> --
>> S pozdravem / Best regards
>> Martin Stiborský
>>
>> Jabber: stibi@njs.netlab.cz
>> Twitter: http://www.twitter.com/stibi
>>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Filtering XML exchange body content

Posted by David Karlsen <da...@gmail.com>.
Maybe try an xslt transform?
Den 23. jan. 2013 23:26 skrev "Martin Stiborský" <ma...@gmail.com>
følgende:

> Hello guys,
> is it possible with standard Camel weapons, to filter XML body with XPath
> to contain only selected data?
> I tried various combination of .setBody(), .XPath() and filter().
> I believe the solution needs .setBody(), but I can't find the correct
> solution.
>
> Thanks!
>
> --
> S pozdravem / Best regards
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz
> Twitter: http://www.twitter.com/stibi
>