Code example for ErrorHandler

Methods: error

            SAXParseException newEx = new SAXParseException(ex.getMessage(),
            if (errorHandler != null) {
            throw newEx;
        return document;
     * Implements the whole parsing of the XML document. The XML pull parser is 
     * actually more of a tokenizer, and we are doing a classical recursive 
     * descent parsing (the method invokes itself for XML elements). Our 
     * approach to parsing does accept some illegal documents (more than one 
     * root element, for example). The assumption is that the DOM implementation 
     * throws the proper exceptions in these cases.