public class StandardInvalidityHandler extends java.lang.Object implements InvalidityHandler
StandardInvalidityHandler
, despite its name, is not directly used by Saxon, and in particular
it is NOT the default InvalidityHandler. It is however available for use by applications, either directly or by
subclassing. (The default InvalidityHandler wraps a supplied ErrorListener).
This InvalidityHandler logs validation error messages to a supplied Logger
, using the Logger belonging
to the supplied Configuration
as the default destination.Constructor and Description |
---|
StandardInvalidityHandler(Configuration config)
Create a Standard Invalidity Handler
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
abbreviatePath(java.lang.String uri)
Abbreviate a URI (if requested)
|
Sequence |
endReporting()
Get the value to be associated with a validation exception.
|
Configuration |
getConfiguration() |
static java.lang.String |
getConstraintReferenceMessage(Invalidity err)
Get the constraint reference as a string for inserting into an error message.
|
java.lang.String |
getExpandedMessage(Invalidity err)
Get a string containing the message for this exception and all contained exceptions
|
java.lang.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(java.lang.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(java.lang.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 java.lang.String getLocationMessage(Invalidity err)
err
- the exception containing the location informationpublic static java.lang.String abbreviatePath(java.lang.String uri)
uri
- the URI to be abbreviatedpublic java.lang.String getExpandedMessage(Invalidity err)
err
- the exception containing the required informationpublic static java.lang.String getConstraintReferenceMessage(Invalidity err)
public Sequence endReporting() throws XPathException
endReporting
in interface InvalidityHandler
XPathException
- if an error occurs creating any validation reportCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.