Re: XPath in camel 3.0

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: XPath in camel 3.0

Claus Ibsen-2
Hi

Yes you should do as last shown importing from camel-xpath when you
want to do a bit more configurations

On Wed, Dec 4, 2019 at 10:03 AM Jimmy Praet (KSZ-BCSS/eHEALTH)
<[hidden email]> wrote:

>
> Hi,
>
> We are upgrading our applications to camel 3.0. We were using the xpath() methods from RouteBuilder in our code as follows:
>
>     .setProperty("postIntegrationCheck", xpath("//version[.='PostIntegrationCheck']").booleanResult())
>     .setProperty("ssinResult", xpath("/ssinResult").nodeResult())
>
> But in camel 3.0, the xpath() method of RouteBuilder returns a ValueBuilder instead of an XPathBuilder, and the .xyzResult() methods are no longer available there.
>
> Is the recommended approach to specify the type as follows:
>
>     .setProperty("postIntegrationCheck", xpath("//version[.='PostIntegrationCheck']", Boolean.class))
>     .setProperty("ssinResult", xpath("/ssinResult", Node.class))
>
> Or is it better to use the XPathBuilder from camel-xpath.jar as follows:
>
>     .setProperty("postIntegrationCheck", XPathBuilder.xpath("//version[.='PostIntegrationCheck']").booleanResult())
>     .setProperty("ssinResult", XPathBuilder.xpath("/ssinResult").nodeResult())
>
> Unfortunately the latter approach cannot be simplified with a static import, because the instance methods of RouteBuilder take precedence.
>
> Kind regards,
> Jimmy



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2