Package net.sf.saxon.lib
Class InvalidityReportGenerator
java.lang.Object
net.sf.saxon.lib.StandardDiagnostics
net.sf.saxon.lib.StandardInvalidityHandler
net.sf.saxon.lib.InvalidityReportGenerator
- All Implemented Interfaces:
InvalidityHandler
- Direct Known Subclasses:
InvalidityReportGeneratorEE
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.-
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionInvalidityReportGenerator
(Configuration config, Outputter receiver) Create a Report Invalidity Handler writing to a Receiver -
Method Summary
Modifier and TypeMethodDescriptionvoid
Create metedata element which contains summary information in the output XML documentGet the value to be associated with a validation exception.int
int
void
reportInvalidity
(Invalidity failure) Receive notification of a validity error.void
setReceiver
(Outputter receiver) Set the receivervoid
setSchemaName
(String name) Set the XSD document used to validation processvoid
setSystemId
(String id) Set the XML document that is to be validatedvoid
setXsdVersion
(String version) void
startReporting
(String systemId) At the start of a validation episode, initialize the handlerMethods inherited from class net.sf.saxon.lib.StandardInvalidityHandler
getConfiguration, getConstraintReferenceMessage, getExpandedMessage, getLocationMessage, getLogger, setLogger
Methods inherited from class net.sf.saxon.lib.StandardDiagnostics
abbreviateLocationURI, abbreviateLocationURIDefault, expandSpecialCharacters, formatListOfOffendingNodes, getInstructionName, getInstructionNameDefault, getLocationMessageText, logStackTrace, showOriginator, wordWrap
-
Field Details
-
REPORT_NS
-
-
Constructor Details
-
InvalidityReportGenerator
-
InvalidityReportGenerator
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
Set the receiver- Parameters:
receiver
- required to output the validation errors
-
setSystemId
Set the XML document that is to be validated- Parameters:
id
- of the source document
-
setSchemaName
Set the XSD document used to validation process- Parameters:
name
- of xsd file
-
getErrorCount
public int getErrorCount() -
getWarningCount
public int getWarningCount() -
setXsdVersion
-
reportInvalidity
Receive notification of a validity error.- Specified by:
reportInvalidity
in interfaceInvalidityHandler
- Overrides:
reportInvalidity
in classStandardInvalidityHandler
- 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
-
startReporting
At the start of a validation episode, initialize the handler- Specified by:
startReporting
in interfaceInvalidityHandler
- Overrides:
startReporting
in classStandardInvalidityHandler
- 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:StandardInvalidityHandler
Get 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:
endReporting
in interfaceInvalidityHandler
- Overrides:
endReporting
in classStandardInvalidityHandler
- 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- Throws:
XPathException
- if creating the element fails for any reason
-