public class SchematronValidator extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ISO_SCHEMATRON_SVRL_NS |
| Constructor and Description |
|---|
SchematronValidator(Source schema)
Constructs a validator for the given Schematron schema with the default
phase enabled.
|
SchematronValidator(Source schema,
String phase)
Constructs a validator for the given Schematron schema and phase (pattern
set).
|
| Modifier and Type | Method and Description |
|---|---|
(package private) net.sf.saxon.s9api.XsltExecutable |
compileSchema(Source schema,
String phase)
Creates an immutable representation of a compiled stylesheet that will
generate an SVRL representation of the validation results when run
against an instance document.
|
(package private) StreamResult |
generateTextResult(Source svrlSource)
Transforms a standard SVRL report to a plain text representation that
only includes rule violations (positive or negative assertion failures).
|
int |
getRuleViolationCount()
Get the number of violations (failed assertions and successful reports)
for the validation episode.
|
(package private) Document |
importElement(Element elem)
Creates a DOM Document with the given Element as the document element.
|
boolean |
ruleViolationsDetected()
Indicates the occurrence of any rule violations.
|
void |
setParameters(Map<String,String> params)
Sets parameters required to evaluate Schematron rules.
|
Result |
validate(Source xmlSource)
Validates the specified XML source document.
|
Result |
validate(Source xmlSource,
boolean svrlReport)
Validates the specified XML source document.
|
ValidationErrorHandler |
validateSchema(Source schema)
Validates a Schematron schema against the official RELAX NG grammar (ISO
19757-3, Annex A).
|
public static final String ISO_SCHEMATRON_SVRL_NS
public SchematronValidator(Source schema) throws Exception
schema - The Source that represents the schema.Exception - If any error occurs while attempting to read or preprocess
the schema.public SchematronValidator(Source schema, String phase) throws Exception
schema - The Source that represents the schema.phase - The active phase; if null, the default phase is enabled (all
patterns are active if no default is specified).Exception - If any error occurs while attempting to read or preprocess
the schema.public ValidationErrorHandler validateSchema(Source schema) throws IOException
schema - A Source to obtain the schema from.IOException - If an error occurs while reading the schema.public int getRuleViolationCount()
int value equal to or greater than zero.public boolean ruleViolationsDetected()
true if any rule violations have been detected;
false otherwise.public void setParameters(Map<String,String> params)
params - A Map<String,String> object containing parameter
names and values.public Result validate(Source xmlSource)
xmlSource - The XML resource to validate. A DOMSource must wrap a Document
or an Element node.public Result validate(Source xmlSource, boolean svrlReport)
xmlSource - The XML resource to validate. A DOMSource must wrap a Document
or an Element node.svrlReport - Produce an SVRL (XML) report; if false, the results are in
plain text.StreamResult generateTextResult(Source svrlSource)
svrlSource - The source for reading the SVRL report.final net.sf.saxon.s9api.XsltExecutable compileSchema(Source schema, String phase) throws Exception
schema - A Source to read a Schematron schema.phase - The name of the active phase; if not specified, the default
phase will be used (all patterns are active if no default is
specified).Exception - If the schema cannot be compiled for any reason.Copyright © 2016 Open Geospatial Consortium. All rights reserved.