You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by krish_p <pk...@gmail.com> on 2016/02/24 14:25:29 UTC

Set Header using xpath

HI There,

I am trying to set a header value using xpath with no luck (Camel 2.16.2)

eg:

.setHeader("scheduleId").xpath("//Schedule/@scheduleId", String.class)

please advice





--
View this message in context: http://camel.465427.n5.nabble.com/Set-Header-using-xpath-tp5778202.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Set Header using xpath

Posted by krish_p <pk...@gmail.com>.
Hi Claus,

My XML has a namespace without a prefix.

Is that causing the issue then?







--
View this message in context: http://camel.465427.n5.nabble.com/Set-Header-using-xpath-tp5778202p5778761.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Set Header using xpath

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Take a look at this page
http://camel.apache.org/xpath

And especially about "auditing namespace to aid debugging"


On Sat, Feb 27, 2016 at 7:15 AM, krish_p <pk...@gmail.com> wrote:
> My XML does not have nay namespace !!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Set-Header-using-xpath-tp5778202p5778344.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Set Header using xpath

Posted by krish_p <pk...@gmail.com>.
My XML does not have nay namespace !!



--
View this message in context: http://camel.465427.n5.nabble.com/Set-Header-using-xpath-tp5778202p5778344.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Set Header using xpath

Posted by Michael Jeppesen <je...@gmail.com>.
Here's how I'm doing it in my route:

.setHeader(Exchange.FILE_NAME, namespace.xpath(FILENAME_XPATH,
String.class))

Hope that helps.

On Wed, Feb 24, 2016 at 5:25 AM, krish_p <pk...@gmail.com> wrote:

> HI There,
>
> I am trying to set a header value using xpath with no luck (Camel 2.16.2)
>
> eg:
>
> .setHeader("scheduleId").xpath("//Schedule/@scheduleId", String.class)
>
> please advice
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Set-Header-using-xpath-tp5778202.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>