diff --git a/ph-schematron-api/src/main/java/com/helger/schematron/SchematronHelper.java b/ph-schematron-api/src/main/java/com/helger/schematron/SchematronHelper.java index 46ab4d456..819143967 100644 --- a/ph-schematron-api/src/main/java/com/helger/schematron/SchematronHelper.java +++ b/ph-schematron-api/src/main/java/com/helger/schematron/SchematronHelper.java @@ -343,6 +343,7 @@ public static IMicroDocument getWithResolvedSchematronIncludes (@Nonnull final I return getWithResolvedSchematronIncludes (aResource, null, aErrorHandler, + (ISchematronIncludeResolver) null, CSchematron.DEFAULT_ALLOW_DEPRECATED_NAMESPACES); } @@ -367,6 +368,7 @@ public static IMicroDocument getWithResolvedSchematronIncludes (@Nonnull final I return getWithResolvedSchematronIncludes (aResource, aSettings, aErrorHandler, + (ISchematronIncludeResolver) null, CSchematron.DEFAULT_ALLOW_DEPRECATED_NAMESPACES); } diff --git a/ph-schematron-pure/src/main/java/com/helger/schematron/pure/exchange/PSReader.java b/ph-schematron-pure/src/main/java/com/helger/schematron/pure/exchange/PSReader.java index 60cac2ac9..44f0f17b2 100644 --- a/ph-schematron-pure/src/main/java/com/helger/schematron/pure/exchange/PSReader.java +++ b/ph-schematron-pure/src/main/java/com/helger/schematron/pure/exchange/PSReader.java @@ -38,6 +38,7 @@ import com.helger.schematron.pure.model.*; import com.helger.schematron.pure.model.PSDir.EDirValue; import com.helger.schematron.pure.model.PSRichGroup.ESpace; +import com.helger.schematron.resolve.ISchematronIncludeResolver; import com.helger.xml.microdom.IMicroDocument; import com.helger.xml.microdom.IMicroElement; import com.helger.xml.microdom.serialize.MicroWriter; @@ -54,6 +55,7 @@ public class PSReader private final IReadableResource m_aResource; private final IPSErrorHandler m_aErrorHandler; + private ISchematronIncludeResolver m_aSchematronIncludeResolver; private final EntityResolver m_aEntityResolver; private boolean m_bLenient = CSchematron.DEFAULT_ALLOW_DEPRECATED_NAMESPACES; @@ -153,6 +155,31 @@ public final PSReader setLenient (final boolean bLenient) return this; } + /** + * @return The custom Schematron include resolver. May be null. + * @since 8.0.5 + */ + @Nullable + public final ISchematronIncludeResolver getSchematronIncludeResolver () + { + return m_aSchematronIncludeResolver; + } + + /** + * Set the customer schematron include resolver to be used. + * + * @param aSchematronIncludeResolver + * The resolver to be used. May be null. + * @return this for chaining + * @since 8.0.5 + */ + @Nonnull + public final PSReader setSchematronIncludeResolver (@Nullable final ISchematronIncludeResolver aSchematronIncludeResolver) + { + m_aSchematronIncludeResolver = aSchematronIncludeResolver; + return this; + } + /** * Utility method to get a real attribute value, by trimming spaces, if the * value is non-null. @@ -1210,6 +1237,7 @@ public PSSchema readSchema () throws SchematronReadException final IMicroDocument aDoc = SchematronHelper.getWithResolvedSchematronIncludes (m_aResource, aSettings, m_aErrorHandler, + m_aSchematronIncludeResolver, m_bLenient); if (aDoc == null || aDoc.getDocumentElement () == null) throw new SchematronReadException (m_aResource,