The parser reports all error messages through this interface, you can choose to ignore exceptions by not throwing them or to stop processing by throwing them.
Reports a Warning while parsing the XML.
warning( SAXParseException exception)
Reports an Error while parsing the XML.
error( SAXParseException exception)
Reports a Fatal Error while parsing the XML.
fatal-error( SAXParseException exception)
Example: Error Handler that forces the underlying parser to stop processing when an error or warning has been reported.
import org.xml.sax.SAXParseException; import org.xml.sax.ErrorHandler; public class DefaultErrorHandler implements ErrorHandler { public void error( SAXParseException e) throws SAXParseException { throw e; } public void warning( SAXParseException e) throws SAXParseException { throw e; } public void fatalError( SAXParseException e) throws SAXParseException { throw e; } }