Package com.helger.schematron
Interface ISchematronResource
- All Superinterfaces:
com.helger.commons.id.IHasID<String>
- All Known Subinterfaces:
ISchematronXSLTBasedResource
- All Known Implementing Classes:
AbstractSchematronResource,AbstractSchematronXSLTBasedResource
Base interface for a Schematron resource. The implementation can e.g. be a
SCH file that needs preprocessing to XSLT or an already precompiled XSLT
file.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionapplySchematronValidation(com.helger.commons.io.IHasInputStream aXMLResource) Apply the Schematron validation on the passed XML resource and return an SVRL XML DOM Document.applySchematronValidation(Source aXMLSource) Apply the Schematron validation on the passed XML source and return an SVRL XML DOM Document.applySchematronValidation(Node aXMLNode, String sBaseURI) Apply the Schematron validation on the passed DOM node and return an SVRL XML DOM Document.applySchematronValidationToSVRL(com.helger.commons.io.IHasInputStream aXMLResource) Apply the Schematron validation on the passed XML resource and return aSchematronOutputTypeobject.applySchematronValidationToSVRL(Source aXMLSource) Apply the Schematron validation on the passed XML source and return aSchematronOutputTypeobject.applySchematronValidationToSVRL(Node aXMLNode, String sBaseURI) Apply the Schematron validation on the passed DOM Node and return aSchematronOutputTypeobject.com.helger.commons.io.resource.IReadableResourcecom.helger.commons.state.EValiditygetSchematronValidity(com.helger.commons.io.IHasInputStream aXMLResource) A method to check if the passed XML DOM node matches the Schematron rules or not.com.helger.commons.state.EValiditygetSchematronValidity(Source aXMLSource) A method to check if the passed XML DOM node matches the Schematron rules or not.com.helger.commons.state.EValiditygetSchematronValidity(Node aXMLNode, String sBaseURI) A method to check if the passed DOM node matches the Schematron rules or not.booleanThis is currently only supported for the "pure Schematron".booleanbooleanvoidsetLenient(boolean bLenient) This is currently only supported for the "pure Schematron".voidsetUseCache(boolean bUseCache) Enable or disable caching.Methods inherited from interface com.helger.commons.id.IHasID
getID
-
Method Details
-
getResource
- Returns:
- The non-
nullresource from which to read the Schematron rules.
-
isUseCache
boolean isUseCache()- Returns:
trueto use caching, if applicable.- Since:
- 5.0.2 in this interface
-
setUseCache
void setUseCache(boolean bUseCache) Enable or disable caching.- Parameters:
bUseCache-trueto use the cache,falseto not use it.- Since:
- 5.0.2 in this interface
-
isLenient
boolean isLenient()This is currently only supported for the "pure Schematron".- Returns:
trueif 'old' schematron NS is tolerated,falseif not. Default isfalse.- Since:
- 5.4.1
-
setLenient
void setLenient(boolean bLenient) This is currently only supported for the "pure Schematron". Allow use of 'old' schematron NS.- Parameters:
bLenient-trueif 'old' schematron NS is tolerated,falseif not.- Since:
- 5.4.1
-
getEntityResolver
- Returns:
- The XML entity resolver to be used to read the Schematron or XML to
be validated. May be
null. - Since:
- 4.1.1 in implementation, 5.0.2 in this interface
-
isValidSchematron
boolean isValidSchematron()- Returns:
trueif this Schematron can be used to validate XML instances. If not, the Schematron is invalid and the log files must be investigated.
-
getSchematronValidity
@Nonnull com.helger.commons.state.EValidity getSchematronValidity(@Nonnull com.helger.commons.io.IHasInputStream aXMLResource) throws Exception A method to check if the passed XML DOM node matches the Schematron rules or not. This is the quick check method, as it breaks upon the first failed assertion or the first successful report, if the implementation supports it (as e.g. the native pure Schematron version).- Parameters:
aXMLResource- The source XML to read and validate against the Schematron. May not benull.- Returns:
EValidity.VALIDif the document is valid,EValidity.INVALIDif it is invalid.- Throws:
Exception- in case of a sever error validating the schema
-
getSchematronValidity
@Nonnull com.helger.commons.state.EValidity getSchematronValidity(@Nonnull Node aXMLNode, @Nullable String sBaseURI) throws Exception A method to check if the passed DOM node matches the Schematron rules or not. This is the quick check method, as it breaks upon the first failed assertion or the first successful report, if the implementation supports it (as e.g. the native pure Schematron version).- Parameters:
aXMLNode- The source DOM node to validate against the Schematron. May not benull.sBaseURI- The Base URI of the XML document to be validated. May benull.- Returns:
EValidity.VALIDif the document is valid,EValidity.INVALIDif it is invalid.- Throws:
Exception- in case of a sever error validating the schema
-
getSchematronValidity
@Nonnull com.helger.commons.state.EValidity getSchematronValidity(@Nonnull Source aXMLSource) throws Exception A method to check if the passed XML DOM node matches the Schematron rules or not. This is the quick check method, as it breaks upon the first failed assertion or the first successful report, if the implementation supports it (as e.g. the native pure Schematron version).- Parameters:
aXMLSource- The source XML to be validated against the Schematron. May not benull.- Returns:
EValidity.VALIDif the document is valid,EValidity.INVALIDif it is invalid.- Throws:
Exception- in case of a sever error validating the schema
-
applySchematronValidation
@Nullable Document applySchematronValidation(@Nonnull com.helger.commons.io.IHasInputStream aXMLResource) throws Exception Apply the Schematron validation on the passed XML resource and return an SVRL XML DOM Document.- Parameters:
aXMLResource- The XML resource to be validated via Schematron. May not benull.- Returns:
nullif the passed resource does not exist or the non-nullSVRL document otherwise.- Throws:
Exception- In case the transformation somehow goes wrong.- See Also:
-
applySchematronValidation
@Nullable Document applySchematronValidation(@Nonnull Node aXMLNode, @Nullable String sBaseURI) throws Exception Apply the Schematron validation on the passed DOM node and return an SVRL XML DOM Document.- Parameters:
aXMLNode- The DOM node to be validated via Schematron. May not benull.sBaseURI- The Base URI of the XML document to be validated. May benull.- Returns:
nullif the passed resource does not exist or the non-nullSVRL document otherwise.- Throws:
Exception- In case the transformation somehow goes wrong.- See Also:
-
applySchematronValidation
Apply the Schematron validation on the passed XML source and return an SVRL XML DOM Document.- Parameters:
aXMLSource- The XML source to be validated via Schematron. May not benull.- Returns:
- The SVRL XML document containing the result. May be
nullwhen interpreting the Schematron failed. - Throws:
Exception- In case the transformation somehow goes wrong.- See Also:
-
applySchematronValidationToSVRL
@Nullable SchematronOutputType applySchematronValidationToSVRL(@Nonnull com.helger.commons.io.IHasInputStream aXMLResource) throws Exception Apply the Schematron validation on the passed XML resource and return aSchematronOutputTypeobject.- Parameters:
aXMLResource- The XML resource to be validated via Schematron. May not benull.- Returns:
- The SVRL object containing the result. May be
nullwhen interpreting the Schematron failed. - Throws:
Exception- In case the transformation somehow goes wrong.
-
applySchematronValidationToSVRL
@Nullable SchematronOutputType applySchematronValidationToSVRL(@Nonnull Node aXMLNode, @Nullable String sBaseURI) throws Exception Apply the Schematron validation on the passed DOM Node and return aSchematronOutputTypeobject.- Parameters:
aXMLNode- The DOM node to be validated via Schematron. May not benull.sBaseURI- The Base URI of the XML document to be validated. May benull.- Returns:
- The SVRL object containing the result. May be
nullwhen interpreting the Schematron failed. - Throws:
Exception- In case the transformation somehow goes wrong.
-
applySchematronValidationToSVRL
@Nullable SchematronOutputType applySchematronValidationToSVRL(@Nonnull Source aXMLSource) throws Exception Apply the Schematron validation on the passed XML source and return aSchematronOutputTypeobject.- Parameters:
aXMLSource- The XML source to be validated via Schematron. May not benull.- Returns:
- The SVRL object containing the result. May be
nullwhen interpreting the Schematron failed. - Throws:
Exception- In case the transformation somehow goes wrong.
-