@NotThreadSafe public class SchematronResourcePure extends AbstractSchematronResource
SchematronResourceSCH or
SchematronResourceXSLT classes instead!AbstractSchematronResource.NodeAndBaseURIDEFAULT_USE_CACHE| Constructor and Description |
|---|
SchematronResourcePure(com.helger.commons.io.resource.IReadableResource aResource) |
SchematronResourcePure(com.helger.commons.io.resource.IReadableResource aResource,
boolean bLenient) |
SchematronResourcePure(com.helger.commons.io.resource.IReadableResource aResource,
String sPhase,
IPSErrorHandler aErrorHandler) |
SchematronResourcePure(com.helger.commons.io.resource.IReadableResource aResource,
String sPhase,
IPSErrorHandler aErrorHandler,
boolean bLenient) |
| Modifier and Type | Method and Description |
|---|---|
Document |
applySchematronValidation(Node aXMLNode,
String sBaseURI)
Apply the Schematron validation on the passed DOM node and return an SVRL
XML DOM Document.
|
SchematronOutputType |
applySchematronValidationToSVRL(Node aXMLNode,
String sBaseURI)
The main method to convert a node to an SVRL document.
|
protected IPSBoundSchema |
createBoundSchema() |
static SchematronResourcePure |
fromByteArray(byte[] aSchematron)
Create a new
SchematronResourcePure from Schematron rules provided
by an arbitrary byte array. |
static SchematronResourcePure |
fromClassPath(String sSCHPath)
Create a new
SchematronResourcePure from a Classpath Schematron
rules |
static SchematronResourcePure |
fromFile(File aSCHFile)
Create a new
SchematronResourcePure from file system Schematron
rules |
static SchematronResourcePure |
fromFile(String sSCHPath)
Create a new
SchematronResourcePure from file system Schematron
rules |
static SchematronResourcePure |
fromInputStream(InputStream aSchematronIS)
Create a new
SchematronResourcePure from Schematron rules provided
by an arbitrary InputStream. |
static SchematronResourcePure |
fromSchema(PSSchema aSchematron)
Create a new
SchematronResourcePure from Schematron rules provided
by a domain model. |
static SchematronResourcePure |
fromString(String sSchematron,
Charset aCharset)
Create a new
SchematronResourcePure from Schematron rules provided
by an arbitrary String. |
static SchematronResourcePure |
fromURL(String sSCHURL)
Create a new
SchematronResourcePure from Schematron rules provided
at a URL |
static SchematronResourcePure |
fromURL(URL aSCHURL)
Create a new
SchematronResourcePure from Schematron rules provided
at a URL |
IPSValidationHandler |
getCustomValidationHandler() |
IPSErrorHandler |
getErrorHandler() |
XPathFunctionResolver |
getFunctionResolver() |
IPSBoundSchema |
getOrCreateBoundSchema()
Get the cached bound schema or create a new one.
|
String |
getPhase() |
com.helger.commons.state.EValidity |
getSchematronValidity(Node aXMLNode,
String sBaseURI)
A method to check if the passed DOM node matches the Schematron rules or
not.
|
XPathVariableResolver |
getVariableResolver() |
boolean |
isValidSchematron() |
SchematronResourcePure |
setCustomValidationHandler(IPSValidationHandler aCustomValidationHandler)
Set the custom validation handler to be used during binding.
|
SchematronResourcePure |
setEntityResolver(EntityResolver aEntityResolver)
Set the XML entity resolver to be used when reading the Schematron or the
XML to be validated.
|
SchematronResourcePure |
setErrorHandler(IPSErrorHandler aErrorHandler)
Set the error handler to be used during binding.
|
SchematronResourcePure |
setPhase(String sPhase)
Set the Schematron phase to be evaluated.
|
SchematronResourcePure |
setXPathConfig(IXPathConfig aXPathConfig)
Set the
XPathConfig to be used in the XPath statements. |
void |
validateCompletely()
Use the internal error handler to validate all elements in the schematron.
|
void |
validateCompletely(IPSErrorHandler aErrorHandler)
Use the provided error handler to validate all elements in the schematron.
|
applySchematronValidation, applySchematronValidation, applySchematronValidationToSVRL, applySchematronValidationToSVRL, getAsNode, getAsNode, getEntityResolver, getID, getResource, getSchematronValidity, getSchematronValidity, internalCreateDOMReaderSettings, internalSetEntityResolver, isLenient, isUseCache, setLenient, setUseCache, toStringpublic SchematronResourcePure(@Nonnull com.helger.commons.io.resource.IReadableResource aResource)
public SchematronResourcePure(@Nonnull com.helger.commons.io.resource.IReadableResource aResource, boolean bLenient)
public SchematronResourcePure(@Nonnull com.helger.commons.io.resource.IReadableResource aResource, @Nullable String sPhase, @Nullable IPSErrorHandler aErrorHandler)
public SchematronResourcePure(@Nonnull com.helger.commons.io.resource.IReadableResource aResource, @Nullable String sPhase, @Nullable IPSErrorHandler aErrorHandler, boolean bLenient)
@Nonnull public final SchematronResourcePure setPhase(@Nullable String sPhase)
sPhase - The name of the phase to use. May be null which means
all phases.@Nullable public final IPSErrorHandler getErrorHandler()
null.@Nonnull public final SchematronResourcePure setErrorHandler(@Nullable IPSErrorHandler aErrorHandler)
aErrorHandler - The error handler. May be null.@Nullable public final IPSValidationHandler getCustomValidationHandler()
null.@Nonnull public final SchematronResourcePure setCustomValidationHandler(@Nullable IPSValidationHandler aCustomValidationHandler)
aCustomValidationHandler - The validation handler. May be null.@Nullable public final XPathVariableResolver getVariableResolver()
null.@Nullable public final XPathFunctionResolver getFunctionResolver()
null.@Nonnull public final SchematronResourcePure setXPathConfig(@Nonnull IXPathConfig aXPathConfig)
XPathConfig to be used in the XPath statements. This can
only be set before the Schematron is bound. If it is already bound an
exception is thrown to indicate the unnecessity of the call.aXPathConfig - The xpath config to set. May be null.@Nonnull public SchematronResourcePure setEntityResolver(@Nullable EntityResolver aEntityResolver)
aEntityResolver - The entity resolver to set. May be null.@Nonnull protected IPSBoundSchema createBoundSchema()
@Nonnull public IPSBoundSchema getOrCreateBoundSchema()
null.public boolean isValidSchematron()
true if this Schematron can be used to validate XML
instances. If not, the Schematron is invalid and the log files must
be investigated.public void validateCompletely()
public void validateCompletely(@Nonnull IPSErrorHandler aErrorHandler)
aErrorHandler - The error handler to use. May not be null.@Nonnull public com.helger.commons.state.EValidity getSchematronValidity(@Nonnull Node aXMLNode, @Nullable String sBaseURI) throws Exception
ISchematronResourceaXMLNode - The source DOM node to validate against the Schematron. May not be
null.sBaseURI - The Base URI of the XML document to be validated. May be
null.EValidity.VALID if the document is valid,
EValidity.INVALID if it is invalid.Exception - in case of a sever error validating the schema@Nonnull public SchematronOutputType applySchematronValidationToSVRL(@Nonnull Node aXMLNode, @Nullable String sBaseURI) throws SchematronException
aXMLNode - The source node to be validated. May not be null.sBaseURI - Base URI of the XML document to be validated. May be
null.null.SchematronException - in case of a sever error validating the schema@Nullable public Document applySchematronValidation(@Nonnull Node aXMLNode, @Nullable String sBaseURI) throws Exception
ISchematronResourceaXMLNode - The DOM node to be validated via Schematron. May not be
null.sBaseURI - The Base URI of the XML document to be validated. May be
null.null if the passed resource does not exist or the non-
null SVRL document otherwise.Exception - In case the transformation somehow goes wrong.on how to convert the
document into a domain object@Nonnull public static SchematronResourcePure fromClassPath(@Nonnull @Nonempty String sSCHPath)
SchematronResourcePure from a Classpath Schematron
rulessSCHPath - The classpath relative path to the Schematron rules.null.@Nonnull public static SchematronResourcePure fromFile(@Nonnull @Nonempty String sSCHPath)
SchematronResourcePure from file system Schematron
rulessSCHPath - The file system path to the Schematron rules.null.@Nonnull public static SchematronResourcePure fromFile(@Nonnull File aSCHFile)
SchematronResourcePure from file system Schematron
rulesaSCHFile - The file system path to the Schematron rules.null.@Nonnull public static SchematronResourcePure fromURL(@Nonnull @Nonempty String sSCHURL) throws MalformedURLException
SchematronResourcePure from Schematron rules provided
at a URLsSCHURL - The URL to the Schematron rules. May neither be null
nor empty.null.MalformedURLException - In case an invalid URL is provided@Nonnull public static SchematronResourcePure fromURL(@Nonnull URL aSCHURL)
SchematronResourcePure from Schematron rules provided
at a URLaSCHURL - The URL to the Schematron rules. May not be null.null.@Nonnull public static SchematronResourcePure fromInputStream(@Nonnull InputStream aSchematronIS)
SchematronResourcePure from Schematron rules provided
by an arbitrary InputStream.aSchematronIS - The InputStream to read the Schematron rules from. May not
be null.null.@Nonnull public static SchematronResourcePure fromByteArray(@Nonnull byte[] aSchematron)
SchematronResourcePure from Schematron rules provided
by an arbitrary byte array.aSchematron - The byte array representing the Schematron. May not be
null.null.@Nonnull public static SchematronResourcePure fromString(@Nonnull String sSchematron, @Nonnull Charset aCharset)
SchematronResourcePure from Schematron rules provided
by an arbitrary String.sSchematron - The String representing the Schematron. May not be null
.aCharset - The charset to be used to convert the String to a byte array.null.@Nonnull public static SchematronResourcePure fromSchema(@Nonnull PSSchema aSchematron)
SchematronResourcePure from Schematron rules provided
by a domain model.aSchematron - The Schematron model to be used. May not be null .null.Copyright © 2014–2020 Philip Helger. All rights reserved.