You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Raymond (Jira)" <ji...@apache.org> on 2022/10/11 12:07:00 UTC

[jira] [Created] (CAMEL-18604) XpathRouteBuilder in Route Templates

Raymond created CAMEL-18604:
-------------------------------

             Summary: XpathRouteBuilder in Route Templates
                 Key: CAMEL-18604
                 URL: https://issues.apache.org/jira/browse/CAMEL-18604
             Project: Camel
          Issue Type: Improvement
    Affects Versions: 3.18.2
            Reporter: Raymond


I like to use a split step with the XPathBuilder in a routetemplate.

It's possible to create a template with a split like this:

         routeTemplate("split-xpath-router")
                 .templateOptionalParameter("expression")
                 .templateParameter("in")
                 .templateParameter("out")
                 .from("\{{in}}")
                     .split().xpath("\{{expression}}")
                         .to("\{{out}}")
                    .end()

However, it doesn't seem possible to use XPathBuilder in the template, because the template parameter doesn't get interpolated. This leads to:

javax.xml.xpath.XPathExpressionException: net.sf.saxon.trans.XPathException: Unexpected token "{" at start of expression

I tried with: 

         routeTemplate("split-xpath-router")
                 .templateOptionalParameter("expression")
                 .templateParameter("in")
                 .templateParameter("out")
                 .from("\{{in}}")
                     .split().xpath("\{{expression}}")
                         .to("\{{out}}")
                    .end()

I tried it like this:



.split({color:#cc7832}new {color}XPathBuilder({color:#6a8759}""{color}).saxon().threadSafety({color:#cc7832}true{color}))

And

.split().method({color:#cc7832}new {color}XPathBuilder({color:#6a8759}""{color}))

I expected it something like this:

         routeTemplate("split-xpath-router")
                 .templateOptionalParameter("expression")
                 .templateParameter("in")
                 .templateParameter("out")
                 .from("\{{in}}")
                     .split().xpathBuilder("\{{expression}}").saxon().threadSafety({color:#cc7832}"true"{color})
                         .to("\{{out}}")
                    .end()



--
This message was sent by Atlassian Jira
(v8.20.10#820010)