@NotThreadSafe public class SchematronResourcePure extends AbstractSchematronResource
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(com.helger.commons.io.IHasInputStream aXMLResource)
Apply the Schematron validation on the passed XML resource and return an
SVRL XML DOM Document.
|
Document |
applySchematronValidation(Source aXMLSource)
Apply the Schematron validation on the passed XML source and return an SVRL
XML DOM Document.
|
SchematronOutputType |
applySchematronValidationToSVRL(com.helger.commons.io.IHasInputStream aXMLResource)
Apply the Schematron validation on the passed XML resource and return a
SchematronOutputType object. |
SchematronOutputType |
applySchematronValidationToSVRL(Node aXMLNode)
The main method to convert a node to an SVRL document.
|
SchematronOutputType |
applySchematronValidationToSVRL(Source aXMLSource)
Apply the Schematron validation on the passed XML source and return a
SchematronOutputType object. |
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() |
protected IPSBoundSchema |
getOrCreateBoundSchema() |
String |
getPhase() |
com.helger.commons.state.EValidity |
getSchematronValidity(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.EValidity |
getSchematronValidity(Source aXMLSource)
A method to check if the passed XML DOM node matches the Schematron rules
or not.
|
XPathVariableResolver |
getVariableResolver() |
boolean |
isValidSchematron() |
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.
|
getID, getResource, 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 protected IPSBoundSchema createBoundSchema()
@Nonnull protected IPSBoundSchema getOrCreateBoundSchema()
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 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@Nonnull public com.helger.commons.state.EValidity getSchematronValidity(@Nonnull com.helger.commons.io.IHasInputStream aXMLResource) throws Exception
ISchematronResource
aXMLResource
- The source XML to read and 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 com.helger.commons.state.EValidity getSchematronValidity(@Nonnull Source aXMLSource) throws Exception
ISchematronResource
aXMLSource
- The source XML to be validated 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@Nullable public Document applySchematronValidation(@Nonnull com.helger.commons.io.IHasInputStream aXMLResource) throws Exception
ISchematronResource
aXMLResource
- The XML resource to validate 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
@Nullable public Document applySchematronValidation(@Nonnull Source aXMLSource) throws Exception
ISchematronResource
aXMLSource
- The XML source to validate via Schematron. May not be
null
.null
when interpreting the Schematron failed.Exception
- In case the transformation somehow goes wrong.on how to convert the document
into a domain object
@Nullable public SchematronOutputType applySchematronValidationToSVRL(@Nonnull com.helger.commons.io.IHasInputStream aXMLResource) throws Exception
ISchematronResource
SchematronOutputType
object.aXMLResource
- The XML resource to validate via Schematron. May not be
null
.null
when interpreting the Schematron failed.Exception
- In case the transformation somehow goes wrong.@Nullable public SchematronOutputType applySchematronValidationToSVRL(@Nonnull Source aXMLSource) throws Exception
ISchematronResource
SchematronOutputType
object.aXMLSource
- The XML source to validate via Schematron. May not be
null
.null
when interpreting the Schematron failed.Exception
- In case the transformation somehow goes wrong.@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–2015 Philip Helger. All rights reserved.