Denis Istomin created CAMEL-20724:
-------------------------------------
Summary: XQuery fluent API does not work with namespaces
(regression from 4.4.0)
Key: CAMEL-20724
URL: https://issues.apache.org/jira/browse/CAMEL-20724
Project: Camel
Issue Type: Bug
Components: camel-saxon
Affects Versions: 4.5.0, 4.4.2, 4.4.1, 4.4.0
Reporter: Denis Istomin
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)