gov.llnl.babel.xml
Class ExceptionErrorHandler

java.lang.Object
  extended by gov.llnl.babel.xml.ExceptionErrorHandler
All Implemented Interfaces:
org.xml.sax.ErrorHandler

public class ExceptionErrorHandler
extends java.lang.Object
implements org.xml.sax.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.


Constructor Summary
ExceptionErrorHandler()
          The ExceptionErrorHandler constructor does nothing.
 
Method Summary
 void error(org.xml.sax.SAXParseException ex)
          Throw a SAXException if the parser issues an error.
 void fatalError(org.xml.sax.SAXParseException ex)
          Throw a SAXException if the parser issues a fatal error.
 void warning(org.xml.sax.SAXParseException ex)
          Throw a SAXException if the parser issues a warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionErrorHandler

public ExceptionErrorHandler()
The ExceptionErrorHandler constructor does nothing.

Method Detail

warning

public void warning(org.xml.sax.SAXParseException ex)
             throws org.xml.sax.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.

Specified by:
warning in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

error

public void error(org.xml.sax.SAXParseException ex)
           throws org.xml.sax.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.

Specified by:
error in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

fatalError

public void fatalError(org.xml.sax.SAXParseException ex)
                throws org.xml.sax.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.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException