Package com.saxonica.ee.validate
Class InvalidityReportGeneratorEE
java.lang.Object
net.sf.saxon.lib.StandardDiagnostics
net.sf.saxon.lib.StandardInvalidityHandler
net.sf.saxon.lib.InvalidityReportGenerator
com.saxonica.ee.validate.InvalidityReportGeneratorEE
- All Implemented Interfaces:
InvalidityHandler
This class
InvalidityReportGenerator extends the standard error handler for errors found during validation
of an instance document against a schema, used if user specifies -report option on validate. Its effect is to output
the validation errors found into the filename specified in an XML format.
The generated report is an XML document whose schema, validation-reports.xsd, is issued in the samples directory. The format is expected to remain compatible across releases, so that the failure report can be analysed by software.
-
Field Summary
Fields inherited from class net.sf.saxon.lib.InvalidityReportGenerator
REPORT_NSFields inherited from class net.sf.saxon.lib.StandardDiagnostics
MAX_MESSAGE_LENGTH, MAX_MESSAGE_LINE_LENGTH, MIN_MESSAGE_LINE_LENGTH, TARGET_MESSAGE_LINE_LENGTH -
Constructor Summary
ConstructorsConstructorDescriptionInvalidityReportGeneratorEE(Configuration config, Receiver receiver) Create a Report Invalidity Handler writing to a ReceiverInvalidityReportGeneratorEE(Configuration config, Destination destination) Create a Report Invalidity Handler writing to a s9api Destination -
Method Summary
Modifier and TypeMethodDescriptionvoidCreate metedata element which contains summary information in the output XML documentGet the value to be associated with a validation exception.intintvoidreportInvalidity(Invalidity failure) Receive notification of a validity error.voidsetDestination(Destination destination) Set the writervoidsetReceiver(Receiver receiver) voidsetSchemaName(String name) Set the XSD document used to validation processvoidsetSystemId(String id) Set the XML document that is to be validatedvoidsetXsdVersion(String version) voidstartReporting(String systemId) At the start of a validation episode, initialize the handlerMethods inherited from class net.sf.saxon.lib.InvalidityReportGenerator
setReceiverMethods inherited from class net.sf.saxon.lib.StandardInvalidityHandler
getConfiguration, getConstraintReferenceMessage, getExpandedMessage, getLocationMessage, getLogger, setLoggerMethods inherited from class net.sf.saxon.lib.StandardDiagnostics
abbreviateLocationURI, abbreviateLocationURIDefault, expandSpecialCharacters, formatListOfOffendingNodes, getInstructionName, getInstructionNameDefault, getLocationMessageText, logStackTrace, showOriginator, wordWrap
-
Constructor Details
-
InvalidityReportGeneratorEE
-
InvalidityReportGeneratorEE
public InvalidityReportGeneratorEE(Configuration config, Destination destination) throws SaxonApiException Create a Report Invalidity Handler writing to a s9api Destination- Parameters:
config- the Saxon configurationdestination- required to output the validation errors- Throws:
SaxonApiException
-
InvalidityReportGeneratorEE
Create a Report Invalidity Handler writing to a Receiver- Parameters:
config- the Saxon configurationreceiver- required to output the validation errors- Throws:
XPathException
-
-
Method Details
-
setReceiver
-
setDestination
Set the writer- Parameters:
destination- required to output the validation errors- Throws:
SaxonApiException
-
setSystemId
Set the XML document that is to be validated- Overrides:
setSystemIdin classInvalidityReportGenerator- Parameters:
id- of the source document
-
setSchemaName
Set the XSD document used to validation process- Overrides:
setSchemaNamein classInvalidityReportGenerator- Parameters:
name- of xsd file
-
getErrorCount
public int getErrorCount()- Overrides:
getErrorCountin classInvalidityReportGenerator
-
getWarningCount
public int getWarningCount()- Overrides:
getWarningCountin classInvalidityReportGenerator
-
setXsdVersion
- Overrides:
setXsdVersionin classInvalidityReportGenerator
-
reportInvalidity
Receive notification of a validity error.- Specified by:
reportInvalidityin interfaceInvalidityHandler- Overrides:
reportInvalidityin classInvalidityReportGenerator- Parameters:
failure- Information about the nature of the invalidity- Throws:
XPathException- - if the validation error cannot be reported. This is fatal and will cause the validation run to be abandoned
-
getDestination
-
startReporting
Description copied from class:InvalidityReportGeneratorAt the start of a validation episode, initialize the handler- Specified by:
startReportingin interfaceInvalidityHandler- Overrides:
startReportingin classInvalidityReportGenerator- Parameters:
systemId- optional; may be used to represent the destination of any report produced- Throws:
XPathException- if initialization of the invalidity handler fails for any reason
-
endReporting
Description copied from class:StandardInvalidityHandlerGet the value to be associated with a validation exception. May return null. In the case of the InvalidityReportGenerator, this returns the XML document containing the validation report- Specified by:
endReportingin interfaceInvalidityHandler- Overrides:
endReportingin classInvalidityReportGenerator- Returns:
- a value (or null). This will be the value returned as the value of the variable $err:value during try/catch processing
- Throws:
XPathException- if an error occurs creating any validation report
-
createMetaData
Create metedata element which contains summary information in the output XML document- Overrides:
createMetaDatain classInvalidityReportGenerator- Throws:
XPathException- if creating the metadata element fails
-