Update pmd-xml

This commit is contained in:
Juan Martín Sotuyo Dodero 2024-04-12 18:24:25 -03:00
parent 322ac4b8d4
commit 71bad39603

View File

@ -31,10 +31,10 @@ import net.sourceforge.pmd.util.DataMap.SimpleDataKey;
import net.sf.saxon.Configuration;
import net.sf.saxon.dom.DocumentWrapper;
import net.sf.saxon.lib.ExtensionFunctionDefinition;
import net.sf.saxon.lib.NamespaceConstant;
import net.sf.saxon.om.AtomicSequence;
import net.sf.saxon.om.Item;
import net.sf.saxon.om.NamePool;
import net.sf.saxon.om.NamespaceUri;
import net.sf.saxon.om.StructuredQName;
import net.sf.saxon.sxpath.IndependentContext;
import net.sf.saxon.sxpath.XPathDynamicContext;
@ -74,16 +74,13 @@ final class SaxonDomXPathQuery {
private XPathExpressionWithProperties makeXPathExpression(String xpath, String defaultUri, List<PropertyDescriptor<?>> properties) {
final IndependentContext xpathStaticContext = new IndependentContext(configuration);
xpathStaticContext.declareNamespace("fn", NamespaceConstant.FN);
xpathStaticContext.setDefaultElementNamespace(defaultUri);
xpathStaticContext.declareNamespace("fn", NamespaceUri.FN);
xpathStaticContext.setDefaultElementNamespace(NamespaceUri.of(defaultUri));
for (XPathFunctionDefinition xpathFun : xpathHandler.getRegisteredExtensionFunctions()) {
ExtensionFunctionDefinition fun = new SaxonExtensionFunctionDefinitionAdapter(xpathFun);
StructuredQName qname = fun.getFunctionQName();
xpathStaticContext.declareNamespace(qname.getPrefix(), qname.getURI());
xpathStaticContext.declareNamespace(qname.getPrefix(), qname.getNamespaceUri());
this.configuration.registerExtensionFunction(fun);
}