Package net.sf.saxon.lib
Class InvalidityReportGenerator
- java.lang.Object
-
- net.sf.saxon.lib.StandardInvalidityHandler
-
- net.sf.saxon.lib.InvalidityReportGenerator
-
- All Implemented Interfaces:
InvalidityHandler
public class InvalidityReportGenerator extends StandardInvalidityHandler
This classInvalidityReportGeneratorextends 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.
-
-
Constructor Summary
Constructors Constructor Description InvalidityReportGenerator(Configuration config)InvalidityReportGenerator(Configuration config, Receiver receiver)Create a Report Invalidity Handler writing to a Receiver
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateMetaData()Create metedata element which contains summary information in the output XML documentSequence<?>endReporting()Get the value to be associated with a validation exception.intgetErrorCount()intgetWarningCount()XMLStreamWritergetWriter()voidreportInvalidity(Invalidity failure)Receive notification of a validity error.voidsetReceiver(Receiver receiver)Set the receivervoidsetSchemaName(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 handler-
Methods inherited from class net.sf.saxon.lib.StandardInvalidityHandler
abbreviatePath, getConfiguration, getConstraintReferenceMessage, getExpandedMessage, getLocationMessage, getLogger, setLogger
-
-
-
-
Field Detail
-
REPORT_NS
public static final String REPORT_NS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InvalidityReportGenerator
public InvalidityReportGenerator(Configuration config)
-
InvalidityReportGenerator
public InvalidityReportGenerator(Configuration config, Receiver receiver) throws XPathException
Create a Report Invalidity Handler writing to a Receiver- Parameters:
config- the Saxon configurationreceiver- required to output the validation errors- Throws:
XPathException
-
-
Method Detail
-
setReceiver
public void setReceiver(Receiver receiver)
Set the receiver- Parameters:
receiver- required to output the validation errors
-
setSystemId
public void setSystemId(String id)
Set the XML document that is to be validated- Parameters:
id- of the source document
-
setSchemaName
public void setSchemaName(String name)
Set the XSD document used to validation process- Parameters:
name- of xsd file
-
getErrorCount
public int getErrorCount()
-
getWarningCount
public int getWarningCount()
-
setXsdVersion
public void setXsdVersion(String version)
-
getWriter
public XMLStreamWriter getWriter()
-
reportInvalidity
public void reportInvalidity(Invalidity failure) throws XPathException
Receive notification of a validity error.- Specified by:
reportInvalidityin interfaceInvalidityHandler- Overrides:
reportInvalidityin 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
public void startReporting(String systemId) throws XPathException
At the start of a validation episode, initialize the handler- Specified by:
startReportingin interfaceInvalidityHandler- Overrides:
startReportingin 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
public Sequence<?> endReporting() throws XPathException
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 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
public void createMetaData() throws XPathExceptionCreate metedata element which contains summary information in the output XML document- Throws:
XPathException
-
-