Error handlers

If the application wishes to be informed of warnings and errors, then it can implement the ErrorHandler interface. This interface includes the following methods for intercepting warnings and errors. These methods all work in the same way, but react to problems of various levels of seriousness:

void  warning(SAXParseException err) throws SAXException;
void  error(SAXParseException err) throws SAXException;
void  fatalError(SAXParseException err)
                                   throws SAXException;

Note that this interface is unchanged in SAX 2.0.

Registration

Typically, the same object that handles normal document events will also handle error events. These methods then just become additional event handlers in the main event-handling object. To inform the parser ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.