public class StandardInvalidityHandler extends Object implements InvalidityHandler
StandardInvalidityHandler
is the standard error handler for errors found during validation
of an instance document against a schema, used if no other InvalidityHandler is nominated. Its effect is to construct
a message containing information about the error, and output this message to a nominated Logger.Constructor and Description |
---|
StandardInvalidityHandler(Configuration config)
Create a Standard Invalidity Handler
|
Modifier and Type | Method and Description |
---|---|
static String |
abbreviatePath(String uri)
Abbreviate a URI (if requested)
|
Sequence |
endReporting()
Get the value to be associated with a validation exception.
|
Configuration |
getConfiguration() |
static String |
getConstraintReferenceMessage(Invalidity err)
Get the constraint reference as a string for inserting into an error message.
|
String |
getExpandedMessage(Invalidity err)
Get a string containing the message for this exception and all contained exceptions
|
String |
getLocationMessage(Invalidity err)
Get a string identifying the location of an error.
|
Logger |
getLogger()
Get the error output stream
|
void |
reportInvalidity(Invalidity failure)
Receive notification of a validity error.
|
void |
setLogger(Logger logger)
Set output destination for error messages (default is the Logger registered with the Configuration)
|
void |
startReporting(String systemId)
At the start of a validation episode, initialize the handler
|
public StandardInvalidityHandler(Configuration config)
config
- the Saxon configurationpublic void setLogger(Logger logger)
logger
- The Logger to use for error messagespublic Logger getLogger()
public Configuration getConfiguration()
public void startReporting(String systemId) throws XPathException
startReporting
in interface InvalidityHandler
systemId
- optional; may be used to represent the destination of any report producedXPathException
- if initialization of the invalidity handler fails for any reasonpublic void reportInvalidity(Invalidity failure) throws XPathException
reportInvalidity
in interface InvalidityHandler
failure
- Information about the nature of the invalidityXPathException
- - if the validation error cannot be reported.
This is fatal and will cause the validation run to be abandonedpublic String getLocationMessage(Invalidity err)
err
- the exception containing the location informationpublic static String abbreviatePath(String uri)
uri
- the URI to be abbreviatedpublic String getExpandedMessage(Invalidity err)
err
- the exception containing the required informationpublic static String getConstraintReferenceMessage(Invalidity err)
public Sequence endReporting() throws XPathException
endReporting
in interface InvalidityHandler
XPathException
- if an error occurs creating any validation reportCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.