Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 60F541087C for ; Tue, 30 Jul 2013 09:09:22 +0000 (UTC) Received: (qmail 10727 invoked by uid 500); 30 Jul 2013 09:09:21 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 10694 invoked by uid 500); 30 Jul 2013 09:09:21 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 10685 invoked by uid 99); 30 Jul 2013 09:09:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Jul 2013 09:09:20 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.214.181 as permitted sender) Received: from [209.85.214.181] (HELO mail-ob0-f181.google.com) (209.85.214.181) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Jul 2013 09:09:16 +0000 Received: by mail-ob0-f181.google.com with SMTP id dn14so11504536obc.12 for ; Tue, 30 Jul 2013 02:08:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=W3Q0Ybp2agDc/3hSjyvXeu9YPIXQHK97S4Uq+ykia/k=; b=L1vkAtB8XlEdpmsTNt+yrsULPJrjH1ln1PHIM/cIbexER51hnYTmPV4TQyblQN+oYa 9utZs4QPmEvXpo9DOUnByYZiWdbOPNkrZ8KreVgE7UJouNXyxp07Lx5cic1ERAV3aHS4 kJPPxda/u7u01sb07Y/s2d8TW5LI98o156AZLksoheXda/6fvagHfapCvWw+kTY1sZPk WLewUdbc0fp+jSC0fAHS2mWOJ6wKtB+CO6uhvViK7u/eB2mgwE2QM5qGS8tKIqLhCMWh nxMi9RxDLk4YejeV98AZehqlb/hAMrU1OGmQJ28TQPFQJp6YX2tFpI6o86Jo3cVQfv7r ASDw== X-Received: by 10.43.57.9 with SMTP id we9mr22150435icb.90.1375175336269; Tue, 30 Jul 2013 02:08:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.86.233 with HTTP; Tue, 30 Jul 2013 02:08:36 -0700 (PDT) In-Reply-To: <001901ce8d02$c895baf0$59c130d0$@de> References: <001901ce8d02$c895baf0$59c130d0$@de> From: Claus Ibsen Date: Tue, 30 Jul 2013 11:08:36 +0200 Message-ID: Subject: Re: XPath + DOM-reuse To: "users@camel.apache.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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=E8rne (jhm) w= rote: > 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 ever= y > 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 =3D new Namespaces("v1", "..."); > > Namespaces v2 =3D new Namespaces("v2", "..."); > > > > from("direct:dispatcher") > > .id("dispatcher") > > .choice() > > .when().xpath("/v1:TypeA", > v1).to("bean:beanA?method=3Dexecute") > > .when().xpath("/v1:TypeB", > v1).to("bean:beanB?method=3Dexecute") > > .when().xpath("/v2:TypeA", > v2).to("bean:beanC?method=3Dexecute") > > .when().xpath("/v2:TypeB", > v2).to("bean:beanD?method=3Dexecute") > > // many more when().xpath().to() statements > > .end(); > > } > > } > > > > > > Jan > --=20 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