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 execQuery(Object node, Map variableBindings) DocumentWrapper docWrapper = new DocumentWrapper(dom, null, config); NodeInfo root = docWrapper.wrap(contextNode); + NamespaceUri emptyUri = NamespaceUri.of(""); DynamicQueryContext dc = new DynamicQueryContext(config); dc.setContextItem(root); - dc.setParameter(new StructuredQName("", null, contextVar), root); + dc.setParameter(new StructuredQName("", emptyUri, contextVar), root); // Set the other variables if (variableBindings != null) { for (Map.Entry me : variableBindings.entrySet()) { - StructuredQName key = new StructuredQName("", null, me.getKey()); + StructuredQName key = new StructuredQName("", emptyUri, me.getKey()); Object value = me.getValue(); if (value instanceof XmlTokenSource) { Node paramObject = ((XmlTokenSource) value).getDomNode(); @@ -282,7 +286,7 @@ private static Item objectToItem(Object value, Configuration config) throws XPat } } else if (value instanceof QName) { QName q = (QName) value; - return new QNameValue(q.getPrefix(), q.getNamespaceURI(), q.getLocalPart()); //BuiltInAtomicType.QNAME, null); + return new QNameValue(q.getPrefix(), NamespaceUri.of(q.getNamespaceURI()), q.getLocalPart()); //BuiltInAtomicType.QNAME, null); } else if (value instanceof URI) { return new AnyURIValue(value.toString()); } else if (value instanceof Map) { diff --git a/src/main/maven/org.apache.xmlbeans/xmlbeans/pom.xml b/src/main/maven/org.apache.xmlbeans/xmlbeans/pom.xml index 553622ded..d756fa3dc 100644 --- a/src/main/maven/org.apache.xmlbeans/xmlbeans/pom.xml +++ b/src/main/maven/org.apache.xmlbeans/xmlbeans/pom.xml @@ -85,7 +85,7 @@ net.sf.saxon Saxon-HE - 11.5 + 12.3 provided diff --git a/src/main/maven/plugin.xml b/src/main/maven/plugin.xml index 371b4b4b9..702847fc1 100644 --- a/src/main/maven/plugin.xml +++ b/src/main/maven/plugin.xml @@ -409,7 +409,7 @@ net.sf.saxon Saxon-HE - 11.5 + 12.3 com.github.javaparser