Package com.helger.schematron.api.xslt
Class AbstractSchematronXSLTBasedResource<IMPLTYPE extends AbstractSchematronXSLTBasedResource<IMPLTYPE>>
java.lang.Object
com.helger.schematron.AbstractSchematronResource
com.helger.schematron.api.xslt.AbstractSchematronXSLTBasedResource<IMPLTYPE>
- Type Parameters:
IMPLTYPE- Implementation type
- All Implemented Interfaces:
com.helger.commons.id.IHasID<String>,com.helger.commons.traits.IGenericImplTrait<IMPLTYPE>,ISchematronXSLTBasedResource,ISchematronResource
@NotThreadSafe
public abstract class AbstractSchematronXSLTBasedResource<IMPLTYPE extends AbstractSchematronXSLTBasedResource<IMPLTYPE>>
extends AbstractSchematronResource
implements ISchematronXSLTBasedResource, com.helger.commons.traits.IGenericImplTrait<IMPLTYPE>
Abstract implementation of a Schematron resource that is based on XSLT
transformations.
- Author:
- Philip Helger
-
Nested Class Summary
Nested classes/interfaces inherited from class com.helger.schematron.AbstractSchematronResource
AbstractSchematronResource.NodeAndBaseURI -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanprotected ErrorListenerprotected URIResolverFields inherited from class com.helger.schematron.AbstractSchematronResource
DEFAULT_USE_CACHE -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSchematronXSLTBasedResource(com.helger.commons.io.resource.IReadableResource aSCHResource) -
Method Summary
Modifier and TypeMethodDescriptionfinal DocumentapplySchematronValidation(Node aXMLNode, String sBaseURI) Apply the Schematron validation on the passed DOM node and return an SVRL XML DOM Document.applySchematronValidationToSVRL(Node aXMLSource, String sBaseURI) Apply the Schematron validation on the passed DOM Node and return aSchematronOutputTypeobject.final ErrorListenerNote: The method was renamed in v8 fromgetXSLTValidator.final com.helger.commons.state.EValiditygetSchematronValidity(Node aXMLNode, String sBaseURI) A method to check if the passed DOM node matches the Schematron rules or not.final URIResolverabstract ISchematronXSLTBasedProviderfinal booleanfinal booleanfinal IMPLTYPEsetEntityResolver(EntityResolver aEntityResolver) Set the XML entity resolver to be used when reading the XML to be validated.final IMPLTYPEsetErrorListener(ErrorListener aCustomErrorListener) final IMPLTYPEsetOutputValidityDeterminator(ISchematronOutputValidityDeterminator aSOVDeterminator) Set the Schematron output validator to be used.
Note: The method was renamed in v8 fromsetXSLTValidator.final IMPLTYPEsetURIResolver(URIResolver aCustomURIResolver) Set theURIResolverto be used for reading Schematron.final IMPLTYPEsetValidateSVRL(boolean bValidateSVRL) Enable or disable the validation of the created SVRL.toString()Methods inherited from class com.helger.schematron.AbstractSchematronResource
applySchematronValidation, applySchematronValidation, applySchematronValidationToSVRL, applySchematronValidationToSVRL, getAsNode, getAsNode, getEntityResolver, getID, getResource, getSchematronValidity, getSchematronValidity, internalCreateDOMReaderSettings, internalSetEntityResolver, isLenient, isUseCache, setLenient, setUseCacheMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.traits.IGenericImplTrait
thisAsTMethods inherited from interface com.helger.commons.id.IHasID
getIDMethods inherited from interface com.helger.schematron.ISchematronResource
applySchematronValidation, applySchematronValidation, applySchematronValidationToSVRL, applySchematronValidationToSVRL, getEntityResolver, getResource, getSchematronValidity, getSchematronValidity, isLenient, isUseCache, setLenient, setUseCacheMethods inherited from interface com.helger.schematron.api.xslt.ISchematronXSLTBasedResource
setAllowForeignElements
-
Field Details
-
DEFAULT_VALIDATE_SVRL
public static final boolean DEFAULT_VALIDATE_SVRL- See Also:
-
m_aCustomErrorListener
-
m_aCustomURIResolver
-
m_aCustomParameters
-
-
Constructor Details
-
AbstractSchematronXSLTBasedResource
public AbstractSchematronXSLTBasedResource(@Nonnull com.helger.commons.io.resource.IReadableResource aSCHResource)
-
-
Method Details
-
getErrorListener
- Specified by:
getErrorListenerin interfaceISchematronXSLTBasedResource- Returns:
- The error listener to be used. May be
null.
-
setErrorListener
- Specified by:
setErrorListenerin interfaceISchematronXSLTBasedResource- Parameters:
aCustomErrorListener- Error listener to use.- Returns:
- this for chaining
-
getURIResolver
- Specified by:
getURIResolverin interfaceISchematronXSLTBasedResource- Returns:
- The
URIResolverto be used for reading the Schematron. May benull.
-
setURIResolver
Description copied from interface:ISchematronXSLTBasedResourceSet theURIResolverto be used for reading Schematron.- Specified by:
setURIResolverin interfaceISchematronXSLTBasedResource- Parameters:
aCustomURIResolver- TheURIResolverto use. May benull,- Returns:
- this for chaining
-
parameters
@Nonnull @ReturnsMutableObject public final com.helger.commons.collection.impl.ICommonsOrderedMap<String,Object> parameters()- Specified by:
parametersin interfaceISchematronXSLTBasedResource- Returns:
- A mutable (=writable) copy of the parameters map. Never
null.
-
setEntityResolver
Set the XML entity resolver to be used when reading the XML to be validated.- Specified by:
setEntityResolverin interfaceISchematronXSLTBasedResource- Parameters:
aEntityResolver- The entity resolver to set. May benull.- Returns:
- this
- Since:
- 4.2.3
- See Also:
-
getXSLTProvider
- Returns:
- The XSLT provider passed in the constructor. May be
null.
-
getOutputValidityDeterminator
Description copied from interface:ISchematronXSLTBasedResourceNote: The method was renamed in v8 fromgetXSLTValidator.- Specified by:
getOutputValidityDeterminatorin interfaceISchematronXSLTBasedResource- Returns:
- The Schematron output validator to be used. Never
null.
-
setOutputValidityDeterminator
@Nonnull public final IMPLTYPE setOutputValidityDeterminator(@Nonnull ISchematronOutputValidityDeterminator aSOVDeterminator) Description copied from interface:ISchematronXSLTBasedResourceSet the Schematron output validator to be used.
Note: The method was renamed in v8 fromsetXSLTValidator.- Specified by:
setOutputValidityDeterminatorin interfaceISchematronXSLTBasedResource- Parameters:
aSOVDeterminator- Validity determinator instance to use. May not benull.- Returns:
- this for chaining
-
isValidateSVRL
public final boolean isValidateSVRL()- Specified by:
isValidateSVRLin interfaceISchematronXSLTBasedResource- Returns:
trueif the created SVRL should be validated or not. Defaults totrue.
-
setValidateSVRL
Description copied from interface:ISchematronXSLTBasedResourceEnable or disable the validation of the created SVRL.- Specified by:
setValidateSVRLin interfaceISchematronXSLTBasedResource- Parameters:
bValidateSVRL-trueto enable XSD validation,falseto disable it.- Returns:
- this for chaining
-
isValidSchematron
public final boolean isValidSchematron()- Specified by:
isValidSchematronin interfaceISchematronResource- 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 public final com.helger.commons.state.EValidity getSchematronValidity(@Nonnull Node aXMLNode, @Nullable String sBaseURI) throws Exception Description copied from interface:ISchematronResourceA 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).- Specified by:
getSchematronValidityin interfaceISchematronResource- 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
-
applySchematronValidation
@Nullable public final Document applySchematronValidation(@Nonnull Node aXMLNode, @Nullable String sBaseURI) throws TransformerException Description copied from interface:ISchematronResourceApply the Schematron validation on the passed DOM node and return an SVRL XML DOM Document.- Specified by:
applySchematronValidationin interfaceISchematronResource- 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:
TransformerException- See Also:
-
applySchematronValidationToSVRL
@Nullable public SchematronOutputType applySchematronValidationToSVRL(@Nonnull Node aXMLSource, @Nullable String sBaseURI) throws Exception Description copied from interface:ISchematronResourceApply the Schematron validation on the passed DOM Node and return aSchematronOutputTypeobject.- Specified by:
applySchematronValidationToSVRLin interfaceISchematronResource- Parameters:
aXMLSource- 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.
-
toString
- Overrides:
toStringin classAbstractSchematronResource
-