286N/A/*
286N/A * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/A// SAX error handler.
286N/A// http://www.saxproject.org
286N/A// No warranty; no copyright -- use this as you will.
286N/A// $Id: ErrorHandler.java,v 1.2 2004/11/03 22:44:52 jsuttor Exp $
286N/A
286N/Apackage org.xml.sax;
286N/A
286N/A
286N/A/**
286N/A * Basic interface for SAX error handlers.
286N/A *
286N/A * <blockquote>
286N/A * <em>This module, both source code and documentation, is in the
286N/A * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
286N/A * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
286N/A * for further information.
286N/A * </blockquote>
286N/A *
286N/A * <p>If a SAX application needs to implement customized error
286N/A * handling, it must implement this interface and then register an
286N/A * instance with the XML reader using the
286N/A * {@link org.xml.sax.XMLReader#setErrorHandler setErrorHandler}
286N/A * method. The parser will then report all errors and warnings
286N/A * through this interface.</p>
286N/A *
286N/A * <p><strong>WARNING:</strong> If an application does <em>not</em>
286N/A * register an ErrorHandler, XML parsing errors will go unreported,
286N/A * except that <em>SAXParseException</em>s will be thrown for fatal errors.
286N/A * In order to detect validity errors, an ErrorHandler that does something
286N/A * with {@link #error error()} calls must be registered.</p>
286N/A *
286N/A * <p>For XML processing errors, a SAX driver must use this interface
286N/A * in preference to throwing an exception: it is up to the application
286N/A * to decide whether to throw an exception for different types of
286N/A * errors and warnings. Note, however, that there is no requirement that
286N/A * the parser continue to report additional errors after a call to
286N/A * {@link #fatalError fatalError}. In other words, a SAX driver class
286N/A * may throw an exception after reporting any fatalError.
286N/A * Also parsers may throw appropriate exceptions for non-XML errors.
286N/A * For example, {@link XMLReader#parse XMLReader.parse()} would throw
286N/A * an IOException for errors accessing entities or the document.</p>
286N/A *
286N/A * @since SAX 1.0
286N/A * @author David Megginson
286N/A * @see org.xml.sax.XMLReader#setErrorHandler
286N/A * @see org.xml.sax.SAXParseException
286N/A */
286N/Apublic interface ErrorHandler {
286N/A
286N/A
286N/A /**
286N/A * Receive notification of a warning.
286N/A *
286N/A * <p>SAX parsers will use this method to report conditions that
286N/A * are not errors or fatal errors as defined by the XML
286N/A * recommendation. The default behaviour is to take no
286N/A * action.</p>
286N/A *
286N/A * <p>The SAX parser must continue to provide normal parsing events
286N/A * after invoking this method: it should still be possible for the
286N/A * application to process the document through to the end.</p>
286N/A *
286N/A * <p>Filters may use this method to report other, non-XML warnings
286N/A * as well.</p>
286N/A *
286N/A * @param exception The warning information encapsulated in a
286N/A * SAX parse exception.
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A * @see org.xml.sax.SAXParseException
286N/A */
286N/A public abstract void warning (SAXParseException exception)
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Receive notification of a recoverable error.
286N/A *
286N/A * <p>This corresponds to the definition of "error" in section 1.2
286N/A * of the W3C XML 1.0 Recommendation. For example, a validating
286N/A * parser would use this callback to report the violation of a
286N/A * validity constraint. The default behaviour is to take no
286N/A * action.</p>
286N/A *
286N/A * <p>The SAX parser must continue to provide normal parsing
286N/A * events after invoking this method: it should still be possible
286N/A * for the application to process the document through to the end.
286N/A * If the application cannot do so, then the parser should report
286N/A * a fatal error even if the XML recommendation does not require
286N/A * it to do so.</p>
286N/A *
286N/A * <p>Filters may use this method to report other, non-XML errors
286N/A * as well.</p>
286N/A *
286N/A * @param exception The error information encapsulated in a
286N/A * SAX parse exception.
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A * @see org.xml.sax.SAXParseException
286N/A */
286N/A public abstract void error (SAXParseException exception)
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Receive notification of a non-recoverable error.
286N/A *
286N/A * <p><strong>There is an apparent contradiction between the
286N/A * documentation for this method and the documentation for {@link
286N/A * org.xml.sax.ContentHandler#endDocument}. Until this ambiguity
286N/A * is resolved in a future major release, clients should make no
286N/A * assumptions about whether endDocument() will or will not be
286N/A * invoked when the parser has reported a fatalError() or thrown
286N/A * an exception.</strong></p>
286N/A *
286N/A * <p>This corresponds to the definition of "fatal error" in
286N/A * section 1.2 of the W3C XML 1.0 Recommendation. For example, a
286N/A * parser would use this callback to report the violation of a
286N/A * well-formedness constraint.</p>
286N/A *
286N/A * <p>The application must assume that the document is unusable
286N/A * after the parser has invoked this method, and should continue
286N/A * (if at all) only for the sake of collecting additional error
286N/A * messages: in fact, SAX parsers are free to stop reporting any
286N/A * other events once this method has been invoked.</p>
286N/A *
286N/A * @param exception The error information encapsulated in a
286N/A * SAX parse exception.
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A * @see org.xml.sax.SAXParseException
286N/A */
286N/A public abstract void fatalError (SAXParseException exception)
286N/A throws SAXException;
286N/A
286N/A}
286N/A
286N/A// end of ErrorHandler.java