@NotThreadSafe public class SchematronResourcePure extends AbstractSchematronResource
SchematronResourceSCH
or
SchematronResourceXSLT
classes instead!Constructor and Description |
---|
SchematronResourcePure(com.helger.commons.io.resource.IReadableResource aResource) |
SchematronResourcePure(com.helger.commons.io.resource.IReadableResource aResource,
String sPhase,
IPSErrorHandler aErrorHandler) |
Modifier and Type | Method and Description |
---|---|
Document |
applySchematronValidation(Node aXMLNode)
Apply the Schematron validation on the passed DOM node and return an SVRL
XML DOM Document.
|
SchematronOutputType |
applySchematronValidationToSVRL(Node aXMLNode)
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 |
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)
A method to check if the passed DOM node matches the Schematron rules or
not.
|
XPathVariableResolver |
getVariableResolver() |
boolean |
isValidSchematron() |
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 |
setFunctionResolver(XPathFunctionResolver aFunctionResolver)
Set the function resolver to be used in the XPath statements.
|
SchematronResourcePure |
setPhase(String sPhase)
Set the Schematron phase to be evaluated.
|
SchematronResourcePure |
setVariableResolver(XPathVariableResolver aVariableResolver)
Set the variable resolver 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, isUseCache, setUseCache, toString
public SchematronResourcePure(@Nonnull com.helger.commons.io.resource.IReadableResource aResource)
public SchematronResourcePure(@Nonnull com.helger.commons.io.resource.IReadableResource aResource, @Nullable String sPhase, @Nullable IPSErrorHandler aErrorHandler)
@Nonnull public SchematronResourcePure setPhase(@Nullable String sPhase)
sPhase
- The name of the phase to use. May be null
which means
all phases.@Nullable public IPSErrorHandler getErrorHandler()
null
.@Nonnull public SchematronResourcePure setErrorHandler(@Nullable IPSErrorHandler aErrorHandler)
aErrorHandler
- The error handler. May be null
.@Nullable public XPathVariableResolver getVariableResolver()
null
.@Nonnull public SchematronResourcePure setVariableResolver(@Nullable XPathVariableResolver aVariableResolver)
aVariableResolver
- The variable resolver to set. May be null
.@Nullable public XPathFunctionResolver getFunctionResolver()
null
.@Nonnull public SchematronResourcePure setFunctionResolver(@Nullable XPathFunctionResolver aFunctionResolver)
aFunctionResolver
- The function resolver 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) throws Exception
ISchematronResource
aXMLNode
- The source DOM node to validate against the Schematron. May not 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) throws SchematronException
aXMLNode
- The source node to be validated. May not be null
.null
.SchematronException
- in case of a sever error validating the schema@Nullable public Document applySchematronValidation(@Nonnull Node aXMLNode) throws Exception
ISchematronResource
aXMLNode
- The DOM node to be validated via Schematron. May not 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–2017 Philip Helger. All rights reserved.