Package com.helger.schematron
Class SchematronHelper
java.lang.Object
com.helger.schematron.SchematronHelper
This is a helper class that provides a way to easily apply an Schematron
resource on an XML resource.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.helger.commons.error.list.IErrorListconvertToErrorList(SchematronOutputType aSchematronOutput, String sResourceName) Convert aSchematronOutputTypeto anIErrorList.static com.helger.commons.collection.impl.ICommonsList<String>getAllValidSchematronNS(boolean bLenient) Get a list of all supported namespaces.static com.helger.xml.microdom.IMicroDocumentgetWithResolvedSchematronIncludes(com.helger.commons.io.resource.IReadableResource aResource, ISchematronErrorHandler aErrorHandler) Resolve all Schematron includes of the passed resource.static com.helger.xml.microdom.IMicroDocumentgetWithResolvedSchematronIncludes(com.helger.commons.io.resource.IReadableResource aResource, com.helger.xml.serialize.read.ISAXReaderSettings aSettings, ISchematronErrorHandler aErrorHandler) Resolve all Schematron includes of the passed resource.static com.helger.xml.microdom.IMicroDocumentgetWithResolvedSchematronIncludes(com.helger.commons.io.resource.IReadableResource aResource, com.helger.xml.serialize.read.ISAXReaderSettings aSettings, ISchematronErrorHandler aErrorHandler, boolean bLenient) Resolve all Schematron includes of the passed resource.static booleanisDeprecatedSchematronNS(String sNamespaceURI) Check if the passed namespace URI is deprecated.static booleanisValidSchematronNS(String sNamespaceURI, boolean bLenient) Check if the passed namespace URI is supported.
-
Method Details
-
isDeprecatedSchematronNS
Check if the passed namespace URI is deprecated.- Parameters:
sNamespaceURI- The namespace URI to check. May benull.- Returns:
trueif the passed namespace URI is a deprecated Schematron namespace URI,falseif not.- Since:
- 5.4.1
-
isValidSchematronNS
Check if the passed namespace URI is supported.- Parameters:
sNamespaceURI- The namespace URI to check. May benull.bLenient-trueto support old namespace URIs,falseif not.- Returns:
trueif the passed namespace URI is a valid Schematron namespace URI,falseif not.- Since:
- 5.4.1
-
getAllValidSchematronNS
@Nonnull @Nonempty @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsList<String> getAllValidSchematronNS(boolean bLenient) Get a list of all supported namespaces.- Parameters:
bLenient-trueto support old namespace URIs,falseif not.- Returns:
- The non-
nulland non-empty list of all supported schematron namespace URIs. - Since:
- 5.4.1
-
convertToErrorList
@Nonnull public static com.helger.commons.error.list.IErrorList convertToErrorList(@Nonnull SchematronOutputType aSchematronOutput, @Nullable String sResourceName) Convert aSchematronOutputTypeto anIErrorList.- Parameters:
aSchematronOutput- The result of Schematron validationsResourceName- The name of the resource that was validated (may be a file path etc.)- Returns:
- List non-
nullerror list ofSVRLResourceErrorobjects.
-
getWithResolvedSchematronIncludes
@Nullable public static com.helger.xml.microdom.IMicroDocument getWithResolvedSchematronIncludes(@Nonnull com.helger.commons.io.resource.IReadableResource aResource, @Nonnull ISchematronErrorHandler aErrorHandler) Resolve all Schematron includes of the passed resource.- Parameters:
aResource- The Schematron resource to read. May not benull.aErrorHandler- The error handler to be used. May not benull.- Returns:
nullif the passed resource could not be read as XML document
-
getWithResolvedSchematronIncludes
@Nullable public static com.helger.xml.microdom.IMicroDocument getWithResolvedSchematronIncludes(@Nonnull com.helger.commons.io.resource.IReadableResource aResource, @Nullable com.helger.xml.serialize.read.ISAXReaderSettings aSettings, @Nonnull ISchematronErrorHandler aErrorHandler) Resolve all Schematron includes of the passed resource.- Parameters:
aResource- The Schematron resource to read. May not benull.aSettings- The SAX reader settings to be used. May benullto use the default settings.aErrorHandler- The error handler to be used. May not benull.- Returns:
nullif the passed resource could not be read as XML document
-
getWithResolvedSchematronIncludes
@Nullable public static com.helger.xml.microdom.IMicroDocument getWithResolvedSchematronIncludes(@Nonnull com.helger.commons.io.resource.IReadableResource aResource, @Nullable com.helger.xml.serialize.read.ISAXReaderSettings aSettings, @Nonnull ISchematronErrorHandler aErrorHandler, boolean bLenient) Resolve all Schematron includes of the passed resource.- Parameters:
aResource- The Schematron resource to read. May not benull.aSettings- The SAX reader settings to be used. May benullto use the default settings.aErrorHandler- The error handler to be used. May not benull.bLenient-trueif 'old' Schematron NS is tolerated.- Returns:
nullif the passed resource could not be read as XML document- Since:
- 5.4.1
-