Hi

I assume you have read this page
http://camel.apache.org/xpath

You need to declare the namespace in your XML file with the Camel route.
eg notice how the foo namespace is defined.

And to get only get NO, you should use /text() to tell xpath to grab
the text content
 <xpath>/erp:CompanyStatusResponse/erp:CompanyActive/text()</xpath>


On Wed, Jun 27, 2012 at 5:12 PM, Kuido <[email protected]> wrote:
> Hello
> In Camel route I want set header from following XML body
>
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";>
> <SOAP-ENV:Header/>
> <SOAP-ENV:Body>
> <erp:CompanyStatusResponse xmlns:erp="http://e-arvetekeskus.eu/erp";>
> <erp:CompanyActive regNumber="11306297">
> NO
> </erp:CompanyActive>
> </erp:CompanyStatusResponse>
> </SOAP-ENV:Body></SOAP-ENV:Envelope>
>
>
> I want catch string "NO" from message body
> In manual ..No namespace given
>  "from message.in.header if there is a header with the given key"
>
> so I set header
>
> <setHeader headerName="erp">
>    <constant>http://e-arvetekeskus.eu/erp</constant>
> </setHeader>
> <setHeader headerName="eArveYES">
>    <xpath>/erp:CompanyStatusResponse/erp:CompanyActive</xpath>
> </setHeader>
>
> but I got error
> Invalid xpath: /erp:CompanyStatusResponse/erp:CompanyActive. Reason:
> javax.xml.xpath.XPathExpressionException
>
> How must correct syntax for xpath expression look like ?
>
> Kuido
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Spring-DSL-XPATH-namespace-query-syntax-with-header-in-key-tp5715171.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to