You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2024/04/29 15:06:00 UTC

[jira] [Commented] (CAMEL-20724) camel-saxon: xquery fluent API does not work with namespaces (regression)

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

Claus Ibsen commented on CAMEL-20724:
-------------------------------------

Can you maybe build an unit test in camel-saxon that reproduces this and send as PR or attach as file to this JIRA

> 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)