You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ankelee <an...@gmail.com> on 2010/03/22 16:15:13 UTC
Re: Filename based on XPath result
Hi
I'm trying to do this:
from("direct:controlMessageToCbr")
.setHeader("envelopeId", xpath("/something/@Id")).to.....
But the header just get set to the XPathBuilder object.
Wouldn't something like the .evaluate() method needed to be used for this
(when using the XPathBuilder in Java)?
String address =
XPathBuilder.xpath("/somthing/@Id").evaluate(exchange.getContext(),
exchange.getIn().getBody(), String.class);
Maybe there's a better soulution to retrieve the id from the xml? I just
want to get hold of it somehow.
--
View this message in context: http://old.nabble.com/Filename-based-on-XPath-result-tp26775964p27987793.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Filename based on XPath result
Posted by ankelee <an...@gmail.com>.
Nevermind this. I was trying to read the header in a processor and forgot
that Camel has a type converter ;)
ankelee wrote:
>
> Hi
>
> I'm trying to do this:
>
> from("direct:controlMessageToCbr")
> .setHeader("envelopeId", xpath("/something/@Id")).to.....
>
> But the header get set to a net.sf.saxon.dom.DOMNodeList object.
>
> Wouldn't something like the .evaluate() method needed to be used for this
> (when using the XPathBuilder in Java)?
>
> String address =
> XPathBuilder.xpath("/somthing/@Id").evaluate(exchange.getContext(),
> exchange.getIn().getBody(), String.class);
>
> How can I refer to the context inside the route?
>
> Maybe there's a better soulution to retrieve the id from the xml? I just
> want to get hold of it somehow.
>
--
View this message in context: http://old.nabble.com/Filename-based-on-XPath-result-tp26775964p27988470.html
Sent from the Camel - Users mailing list archive at Nabble.com.