diff --git a/src/main/java/com/xmlcalabash/core/XProcRuntime.java b/src/main/java/com/xmlcalabash/core/XProcRuntime.java index 065d921b..a7ce9f40 100644 --- a/src/main/java/com/xmlcalabash/core/XProcRuntime.java +++ b/src/main/java/com/xmlcalabash/core/XProcRuntime.java @@ -230,14 +230,14 @@ public XProcRuntime(XProcConfiguration config) { try { if (config.uriResolver != null) { - uriResolver.setUnderlyingURIResolver(Class.forName(config.uriResolver).asSubclass(URIResolver.class).newInstance()); + uriResolver.setUnderlyingURIResolver(Class.forName(config.uriResolver).asSubclass(URIResolver.class).getDeclaredConstructor().newInstance()); } if (config.entityResolver != null) { - uriResolver.setUnderlyingEntityResolver(Class.forName(config.entityResolver).asSubclass(EntityResolver.class).newInstance()); + uriResolver.setUnderlyingEntityResolver(Class.forName(config.entityResolver).asSubclass(EntityResolver.class).getDeclaredConstructor().newInstance()); } if (config.errorListener != null) { - msgListener = Class.forName(config.errorListener).asSubclass(XProcMessageListener.class).newInstance(); + msgListener = Class.forName(config.errorListener).asSubclass(XProcMessageListener.class).getDeclaredConstructor().newInstance(); } else { msgListener = new DefaultXProcMessageListener(); } @@ -280,7 +280,7 @@ public XProcRuntime(XProcConfiguration config) { Object def = null; try { - def = Class.forName(className).newInstance(); + def = Class.forName(className).getDeclaredConstructor().newInstance(); } catch (Throwable e) { logger.trace("Attempting to instantiate " + className + " with processor context"); Class cl = Class.forName(className); diff --git a/src/main/java/com/xmlcalabash/extensions/CssFormatter.java b/src/main/java/com/xmlcalabash/extensions/CssFormatter.java index 3a8f85d0..9e59ebf4 100644 --- a/src/main/java/com/xmlcalabash/extensions/CssFormatter.java +++ b/src/main/java/com/xmlcalabash/extensions/CssFormatter.java @@ -85,7 +85,7 @@ public void run() throws SaxonApiException { final CssProcessor provider; try { - provider = (CssProcessor) Class.forName(cssClass).newInstance(); + provider = (CssProcessor) Class.forName(cssClass).getDeclaredConstructor().newInstance(); provider.initialize(runtime,step,options); } catch (Exception e) { logger.debug(e.getMessage(), e); diff --git a/src/main/java/com/xmlcalabash/library/ValidateWithSCH.java b/src/main/java/com/xmlcalabash/library/ValidateWithSCH.java index 45002e4e..32727de4 100644 --- a/src/main/java/com/xmlcalabash/library/ValidateWithSCH.java +++ b/src/main/java/com/xmlcalabash/library/ValidateWithSCH.java @@ -10,6 +10,8 @@ import com.xmlcalabash.runtime.XAtomicStep; import com.xmlcalabash.util.S9apiUtils; import net.sf.saxon.Configuration; +import net.sf.saxon.lib.ResourceRequest; +import net.sf.saxon.lib.ResourceResolver; import net.sf.saxon.om.NamespaceUri; import net.sf.saxon.om.StructuredQName; import net.sf.saxon.s9api.QName; @@ -131,7 +133,7 @@ public void run() throws SaxonApiException { compiler = runtime.getProcessor().newXsltCompiler(); compiler.setSchemaAware(schemaAware); - compiler.setURIResolver(new UResolver()); + compiler.setResourceResolver(new UResolver()); exec = compiler.compile(getSchematronXSLT("iso_svrl_for_xslt2.xsl")); XsltTransformer schemaCompiler = exec.load(); @@ -239,13 +241,13 @@ private boolean checkFailedAssert(XdmNode doc) { return results.size() != 0; } - private class UResolver implements URIResolver { - - public Source resolve(String href, String base) throws TransformerException { - if ("iso_schematron_skeleton_for_saxon.xsl".equals(href)) { + private class UResolver implements ResourceResolver { + @Override + public Source resolve(ResourceRequest request) throws XPathException { + if ("iso_schematron_skeleton_for_saxon.xsl".equals(request.relativeUri)) { return new SAXSource(new InputSource(skeleton)); } else { - throw new XProcException(step.getNode(), "Failed to resolve " + href + " from JAR file."); + throw new XProcException(step.getNode(), "Failed to resolve " + request.uri + " from JAR file."); } } } @@ -262,7 +264,7 @@ private SAXSource getSchematronXSLT(String xslt) { private XdmNode transform(XdmNode source, SAXSource stylesheet) throws SaxonApiException { XsltCompiler compiler = runtime.getProcessor().newXsltCompiler(); compiler.setSchemaAware(schemaAware); - compiler.setURIResolver(new UResolver()); + compiler.setResourceResolver(new UResolver()); XsltExecutable exec = compiler.compile(stylesheet); XsltTransformer schemaCompiler = exec.load(); diff --git a/src/main/java/com/xmlcalabash/library/XSLFormatter.java b/src/main/java/com/xmlcalabash/library/XSLFormatter.java index 51322a1c..34db1454 100644 --- a/src/main/java/com/xmlcalabash/library/XSLFormatter.java +++ b/src/main/java/com/xmlcalabash/library/XSLFormatter.java @@ -81,7 +81,7 @@ public void run() throws SaxonApiException { for (String className : foClasses) { if (provider == null) { try { - provider = (FoProcessor) Class.forName(className).newInstance(); + provider = (FoProcessor) Class.forName(className).getDeclaredConstructor().newInstance(); provider.initialize(runtime,step,options); break; } catch (NoClassDefFoundError ncdfe) {