camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: XPath + DOM-reuse
Date Tue, 30 Jul 2013 09:08:36 GMT
Hi

You can convert the body to DOM first

from
.convertBodyTo(Document.class)
choice




Also you can add camel-saxon to the classpath to use saxon as the
xpath engine. Its faster than what comes out of the box in the JDK.


You can use vtd-xml for an xpath language that can work with streamed data types
http://camel.apache.org/vtd-xml

On Tue, Jul 30, 2013 at 10:57 AM, Jan Matèrne (jhm) <apache@materne.de> wrote:
> I have a route dispatching an exchange according to a XPath evaluation to
> different targets.
>
> Sadly it doesnt perform very well. I think that the DOM is built for every
> XPath evalutation.
>
> Is it true? Can we configure Camel to reuse the DOM?
>
>
>
> I think in this Route Camel builds the same DOM 4 times.
>
>
>
> public class MyRouter extends RouteBuilder {
>
>     @Override
>
>     public void configure() throws Exception {
>
>         Namespaces v1 = new Namespaces("v1", "...");
>
>         Namespaces v2 = new Namespaces("v2", "...");
>
>
>
>         from("direct:dispatcher")
>
>             .id("dispatcher")
>
>             .choice()
>
>                 .when().xpath("/v1:TypeA",
> v1).to("bean:beanA?method=execute")
>
>                 .when().xpath("/v1:TypeB",
> v1).to("bean:beanB?method=execute")
>
>                 .when().xpath("/v2:TypeA",
> v2).to("bean:beanC?method=execute")
>
>                 .when().xpath("/v2:TypeB",
> v2).to("bean:beanD?method=execute")
>
>                 // many more when().xpath().to() statements
>
>             .end();
>
>     }
>
> }
>
>
>
>
>
> Jan
>



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

Mime
View raw message