I get the same error when running the API directly (from
2.8-SNAPSHOT)...either way, I'll look into it a bit...

XPathBuilder upperCaseBuilder =
XPathBuilder.xpath("upper-case(/order/status/text())");
String result = upperCaseBuilder.evaluate(context, "<order
customerId=\"123\"><status>in progress</status></order>");

org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath:
upper-case(/order/status/text()). Reason:
javax.xml.xpath.XPathExpressionException
        at
org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:631)
        ...


l_tsall wrote:
> 
> Can I combine Xpath 2 functions with camel xpath annotations?
> 
> For example
> 
> public void updateStatus(@XPath("/order/@customerId") Integer customerId,
>                                      @XPath("order/status/text()") String
> status
>                                     
> @XPath("upper-case(order/status/text())") String uppercaseStatus
>                                       )  
> Gives a
> org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath:
> upper-case(order/status/text()). Reason:
> javax.xml.xpath.XPathExpressionException
> 
> Caused by: net.sf.saxon.trans.XPathException: Extension function required
> class org.w3c.dom.NodeList; supplied value of class
> net.sf.saxon.value.StringValue could not be converted
> 
> The following example works as expected
> 
>  XPathBuilder upperCaseBuilder =
> XPathBuilder.xpath("upper-case(/order/status/text())");
>  String result = upperCaseBuilder.evaluate(context, "<order
> customerId=\"123\"><status>in progress</status></order>");
>  assertEquals("IN PROGRESS", result);
> 


-----
Ben O'Day
IT Consultant -http://benoday.blogspot.com

--
View this message in context: 
http://camel.465427.n5.nabble.com/xpath-2-0-function-bean-binding-camel-xpath-annotation-tp4344611p4344745.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to