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 C67BC10BC0 for ; Tue, 30 Jul 2013 10:07:47 +0000 (UTC) Received: (qmail 28607 invoked by uid 500); 30 Jul 2013 10:07:44 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 28561 invoked by uid 500); 30 Jul 2013 10:07:43 -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 28553 invoked by uid 99); 30 Jul 2013 10:07:40 -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 10:07:40 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of raul@evosent.com designates 209.85.220.45 as permitted sender) Received: from [209.85.220.45] (HELO mail-pa0-f45.google.com) (209.85.220.45) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Jul 2013 10:07:36 +0000 Received: by mail-pa0-f45.google.com with SMTP id bg4so6974760pad.4 for ; Tue, 30 Jul 2013 03:07:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:from:date :message-id:subject:to:content-type:x-gm-message-state; bh=bJ8lkKRpSqauCi0I2NqYe1Nyv4Xd1UdXw/nuCPvSthY=; b=KpprpbsCfIUc0wlMdrpW9z7MtX7JtsiMf8mGChylirSAxpxwXbO21oiiNoOWQ7TOyb G5hbQ/lQX7IhlI1O8ITLhcW4rrkDtQwQF6QYJYnX0G5HRRp26uNPKO4Ay1qDifsyNvRE kiZfhVYUqDalMls63hGLcE9E5AM91Ut6+Zi4jztICK4oeLCrK/Nfb3QlwSvpI4wxIYpW DwpfhlQVHzK9DHHWTITWXDnsEQgntlYCABKWrF8GHETgY16LsExo+XTQ3AlAqFvWYkoF t/LXBlFe+TFedyVU7mM/fqChWOIvDC8dqSpDu3Yv8eAaTM7z+ZjSwelOHBbBHvp6RRn8 nGvw== X-Received: by 10.68.242.105 with SMTP id wp9mr72569412pbc.153.1375178835338; Tue, 30 Jul 2013 03:07:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.70.26.195 with HTTP; Tue, 30 Jul 2013 03:06:52 -0700 (PDT) X-Originating-IP: [85.155.64.119] In-Reply-To: <002201ce8d05$7f386bc0$7da94340$@de> References: <001901ce8d02$c895baf0$59c130d0$@de> <002201ce8d05$7f386bc0$7da94340$@de> From: Raul Kripalani Date: Tue, 30 Jul 2013 11:06:52 +0100 Message-ID: Subject: Re: XPath + DOM-reuse To: "users@camel.apache.org" Content-Type: multipart/alternative; boundary=047d7b339c03fbbb9704e2b7c567 X-Gm-Message-State: ALoCoQkNNUWptu0HINWqFqiMEA1aMU4lER1+RUIA7eZtJozyoYqg4AisHAD7tqh9jUPamMMV1Iii X-Virus-Checked: Checked by ClamAV on apache.org --047d7b339c03fbbb9704e2b7c567 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Just a little tip. Be careful with concurrency as DOM is not thread-safe. So if you've got multiple XPath expressions or XSLT transformations running in parallel (e.g. multicast EIP), you might get errors. Regards, Ra=FAl. On Tue, Jul 30, 2013 at 10:16 AM, Jan Mat=E8rne (jhm) wr= ote: > Thanks, I will try ... > > Jan > > > -----Urspr=FCngliche Nachricht----- > > Von: Claus Ibsen [mailto:claus.ibsen@gmail.com] > > Gesendet: Dienstag, 30. Juli 2013 11:09 > > An: users@camel.apache.org > > Betreff: Re: XPath + DOM-reuse > > > > 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) > > 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 =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 > > > > > > > > > > > -- > > 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 > > --047d7b339c03fbbb9704e2b7c567--