gov.llnl.babel.xml
Class ExceptionErrorHandler
java.lang.Object
gov.llnl.babel.xml.ExceptionErrorHandler
- ErrorHandler
public class ExceptionErrorHandler
extends java.lang.Object
implements ErrorHandler
The ExceptionErrorHandler
class implements an error handler
for XML SAX and DOM parsers. This error handler throws an exception of
type SAXException
for all warnings, errors, and fatal errors.
void | error(SAXParseException ex) - Throw a
SAXException if the parser issues an error.
|
void | fatalError(SAXParseException ex) - Throw a
SAXException if the parser issues a fatal error.
|
void | warning(SAXParseException ex) - Throw a
SAXException if the parser issues a warning.
|
ExceptionErrorHandler
public ExceptionErrorHandler()
The ExceptionErrorHandler
constructor does nothing.
error
public void error(SAXParseException ex)
throws SAXException
Throw a SAXException
if the parser issues an error.
SAX parsers issue an error to report conditions that are errors
by the W3C XML recommendation but are recoverable errors. The
default behavior for errors is to take no action; we throw an
exception since we want our XML documents to be well-formed and
valid.
fatalError
public void fatalError(SAXParseException ex)
throws SAXException
Throw a SAXException
if the parser issues a fatal error.
SAX parsers issue a fatal error if it cannot continue parsing the XML
document. The default behavior for fatal errors is to throw an
exception of type SAXException
.
warning
public void warning(SAXParseException ex)
throws SAXException
Throw a SAXException
if the parser issues a warning.
SAX parsers issue a warning to report conditions that are not errors
or fatal errors by the XML 1.0 recommendation. By definition, the
parser could recover from a warning. The default parser action for
a warning is to take no action; by throwing an exception, we ensure
that all XML documents are up to our high standards of quality.