[ 
https://issues.apache.org/jira/browse/CAMEL-20724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17842482#comment-17842482
 ] 

Denis Istomin commented on CAMEL-20724:
---------------------------------------

Made a PR with unit-test and a fix itself

> camel-saxon: xquery fluent API does not work with namespaces (regression)
> -------------------------------------------------------------------------
>
>                 Key: CAMEL-20724
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20724
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-saxon
>    Affects Versions: 4.4.0, 4.4.1, 4.4.2, 4.5.0
>            Reporter: Denis Istomin
>            Priority: Minor
>             Fix For: 4.x
>
>
> This is a regression starting from 4.4.0
> Reproducer:
> [https://github.com/DenisIstomin/camel-xquery-ns-bug]
> Does not work:
> {code:java}
> Namespaces ns = new Namespaces("soap", 
> "http://schemas.xmlsoap.org/soap/envelope/";);
> String strExpression = "exists(/soap:Envelope/soap:Header)";
> expression().xquery().expression(strExpression).resultType(String.class).namespaces(ns).end();
> {code}
> Throws exception:
> {code:java}
> net.sf.saxon.trans.XPathException: Namespace prefix 'soap' has not been 
> declared
> {code}
> Workaround is to use XQueryBuilder:
> {code:java}
> XQueryBuilder xqueryBuilder = xquery(strExpression).resultType(String.class);
> xqueryBuilder.setNamespaces(ns.getNamespaces());
> {code}



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

Reply via email to