You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by titexe <Ab...@eurofins.com> on 2009/09/23 18:27:40 UTC
fail filter XPATH (camel)
Hello,
I'm trying to developp camel route to filter messages XML format (xpath)
This is my configuration:
<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<route>
<from uri="activemq:XML"/>
<choice>
<when>
<xpath>/Envelope/Header[Action='Customer']</xpath>
<to uri="activemq:queue:CUSTOMER"/>
</when>
<otherwise>
<to uri="activemq:queue:CONTACT"/>
</otherwise>
</choice>
</route>
</camelContext>
This configuration work very fine for message in this xml format :
<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<Header>
<Action>Customer</Action>
</Header>
But in this XML format, does not work:
xml version = "1.0" encoding = "UTF-8"?
<Envelope
Xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/Message">
<Header>
<Action> Customer </ Action>
</ Header>
There's someone who could help me solve this problem,
thank you in advance
version activemq : fuse message broker 5.3.0.3
version java : Java 1.6
Best regards,
titexe
--
View this message in context: http://www.nabble.com/fail-filter-XPATH-%28camel%29-tp25531213p25531213.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: fail filter XPATH (camel)
Posted by Maciej Prochniak <mp...@touk.pl>.
Hi,
guess you need to make your xpath namespace aware.
you can find example here: http://camel.apache.org/xpath.html,
in part named 'Using XML configuration'
In your case I guess it would look sth like:
<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
xmlns:ns="http://schemas.microsoft.com/dynamics/2006/02/documents/Message"
<route>
<from uri="activemq:XML"/>
<choice>
<when>
<xpath>/ns:Envelope/ns:Header[ns:Action='Customer']</xpath>
<to uri="activemq:queue:CUSTOMER"/>
</when>
<otherwise>
<to uri="activemq:queue:CONTACT"/>
</otherwise>
</choice>
</route>
</camelContext>
- but I didn't check it - so it may be a bit different ;)
br,
maciek
On Wed, 2009-09-23 at 09:27 -0700, titexe wrote:
> Hello,
>
> I'm trying to developp camel route to filter messages XML format (xpath)
>
> This is my configuration:
>
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <route>
> <from uri="activemq:XML"/>
> <choice>
> <when>
> <xpath>/Envelope/Header[Action='Customer']</xpath>
> <to uri="activemq:queue:CUSTOMER"/>
> </when>
> <otherwise>
> <to uri="activemq:queue:CONTACT"/>
> </otherwise>
> </choice>
> </route>
> </camelContext>
>
> This configuration work very fine for message in this xml format :
> <?xml version="1.0" encoding="UTF-8"?>
> <Envelope>
> <Header>
> <Action>Customer</Action>
> </Header>
>
> But in this XML format, does not work:
>
> xml version = "1.0" encoding = "UTF-8"?
> <Envelope
> Xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/Message">
> <Header>
> <Action> Customer </ Action>
> </ Header>
>
>
> There's someone who could help me solve this problem,
>
> thank you in advance
>
> version activemq : fuse message broker 5.3.0.3
> version java : Java 1.6
>
> Best regards,
>
> titexe
>
Re: fail filter XPATH (camel)
Posted by titexe <Ab...@eurofins.com>.
Problem fixed : the declaration of namespace must be in camel context not in
bean.
Thank you for your reactivity
titexe wrote:
>
> Hello,
>
> I'm trying to developp camel route to filter messages XML format (xpath)
>
> This is my configuration:
>
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <route>
> <from uri="activemq:XML"/>
> <choice>
> <when>
> <xpath>/Envelope/Header[Action='Customer']</xpath>
> <to uri="activemq:queue:CUSTOMER"/>
> </when>
> <otherwise>
> <to uri="activemq:queue:CONTACT"/>
> </otherwise>
> </choice>
> </route>
> </camelContext>
>
> This configuration work very fine for message in this xml format :
> <?xml version="1.0" encoding="UTF-8"?>
> <Envelope>
> <Header>
> <Action>Customer</Action>
> </Header>
>
> But in this XML format, does not work:
>
> xml version = "1.0" encoding = "UTF-8"?
> <Envelope
> Xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/Message">
> <Header>
> <Action> Customer </ Action>
> </ Header>
>
>
> There's someone who could help me solve this problem,
>
> thank you in advance
>
> version activemq : fuse message broker 5.3.0.3
> version java : Java 1.6
>
> Best regards,
>
> titexe
>
>
--
View this message in context: http://www.nabble.com/fail-filter-XPATH-%28camel%29-tp25531213p25611336.html
Sent from the Camel - Users mailing list archive at Nabble.com.