diff --git a/LICENSE-binary.txt b/LICENSE-binary.txt
index 759c30c8c..13191cf7b 100755
--- a/LICENSE-binary.txt
+++ b/LICENSE-binary.txt
@@ -234,4 +234,4 @@ org.slf4j:slf4j-api:1.7.25
Mozilla Public License 2.0
--------------------------
-net.sf.saxon:Saxon-HE:11.5
+net.sf.saxon:Saxon-HE:12.3
diff --git a/build.gradle b/build.gradle
index e19ab851f..5be777440 100644
--- a/build.gradle
+++ b/build.gradle
@@ -69,7 +69,7 @@ ext {
antVersion = '1.10.14'
javaparserVersion = '3.25.5'
log4jVersion = '2.20.0'
- saxonVersion = '11.5'
+ saxonVersion = '12.3'
androidSdkMinimum = '26'
}
diff --git a/build.xml b/build.xml
index f80a00931..9245bf17c 100644
--- a/build.xml
+++ b/build.xml
@@ -121,7 +121,7 @@
-
+
diff --git a/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXPath.java b/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXPath.java
index a6aaa4ae4..c0362efee 100644
--- a/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXPath.java
+++ b/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXPath.java
@@ -18,6 +18,7 @@
import net.sf.saxon.Configuration;
import net.sf.saxon.dom.DOMNodeWrapper;
import net.sf.saxon.om.Item;
+import net.sf.saxon.om.NamespaceUri;
import net.sf.saxon.om.NodeInfo;
import net.sf.saxon.om.SequenceTool;
import net.sf.saxon.sxpath.*;
@@ -94,16 +95,18 @@ public List selectNodes(Object node) {
// also see https://saxonica.plan.io/issues/2130
// (XPath referencing attribute with namespace fails when using DOM)
if (defaultNS != null) {
- sc.setDefaultElementNamespace(defaultNS);
+ sc.setDefaultElementNamespace(NamespaceUri.of(defaultNS));
}
- namespaceMap.forEach(sc::declareNamespace);
+ for (Map.Entry entry : namespaceMap.entrySet()) {
+ sc.declareNamespace(entry.getKey(), NamespaceUri.of(entry.getValue()));
+ }
NodeInfo contextItem = config.unravel(new DOMSource(contextNode));
XPathEvaluator xpe = new XPathEvaluator(config);
xpe.setStaticContext(sc);
- XPathVariable thisVar = sc.declareVariable("", contextVar);
+ XPathVariable thisVar = sc.declareVariable(NamespaceUri.of(""), contextVar);
XPathExpression xpath = xpe.createExpression(path);
XPathDynamicContext dc = xpath.createDynamicContext(null);
dc.setContextItem(contextItem);
diff --git a/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXQuery.java b/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXQuery.java
index 623e6d710..043c8b06d 100644
--- a/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXQuery.java
+++ b/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXQuery.java
@@ -20,6 +20,7 @@
import net.sf.saxon.dom.NodeOverNodeInfo;
import net.sf.saxon.ma.map.HashTrieMap;
import net.sf.saxon.om.Item;
+import net.sf.saxon.om.NamespaceUri;
import net.sf.saxon.om.NodeInfo;
import net.sf.saxon.om.StructuredQName;
import net.sf.saxon.query.DynamicQueryContext;
@@ -81,7 +82,9 @@ public SaxonXQuery(final String query, String contextVar, Integer boundary, XmlO
StaticQueryContext sc = config.newStaticQueryContext();
Map nsMap = xmlOptions.getLoadAdditionalNamespaces();
if (nsMap != null) {
- nsMap.forEach(sc::declareNamespace);
+ for (Map.Entry entry : nsMap.entrySet()) {
+ sc.declareNamespace(entry.getKey(), NamespaceUri.of(entry.getValue()));
+ }
}
this.contextVar = contextVar;
//Saxon requires external variables at the end of the prolog...
@@ -176,13 +179,14 @@ public List