001: /* Copyright 2000 - 2001 Quadcap Software. All rights reserved.
002: *
003: * This software is distributed under the Quadcap Free Software License.
004: * This software may be used or modified for any purpose, personal or
005: * commercial. Open Source redistributions are permitted. Commercial
006: * redistribution of larger works derived from, or works which bundle
007: * this software requires a "Commercial Redistribution License"; see
008: * http://www.quadcap.com/purchase.
009: *
010: * Redistributions qualify as "Open Source" under one of the following terms:
011: *
012: * Redistributions are made at no charge beyond the reasonable cost of
013: * materials and delivery.
014: *
015: * Redistributions are accompanied by a copy of the Source Code or by an
016: * irrevocable offer to provide a copy of the Source Code for up to three
017: * years at the cost of materials and delivery. Such redistributions
018: * must allow further use, modification, and redistribution of the Source
019: * Code under substantially the same terms as this license.
020: *
021: * Redistributions of source code must retain the copyright notices as they
022: * appear in each source code file, these license terms, and the
023: * disclaimer/limitation of liability set forth as paragraph 6 below.
024: *
025: * Redistributions in binary form must reproduce this Copyright Notice,
026: * these license terms, and the disclaimer/limitation of liability set
027: * forth as paragraph 6 below, in the documentation and/or other materials
028: * provided with the distribution.
029: *
030: * The Software is provided on an "AS IS" basis. No warranty is
031: * provided that the Software is free of defects, or fit for a
032: * particular purpose.
033: *
034: * Limitation of Liability. Quadcap Software shall not be liable
035: * for any damages suffered by the Licensee or any third party resulting
036: * from use of the Software.
037: */
038:
039: // SAX error handler.
040: // No warranty; no copyright -- use this as you will.
041: // $Id: ErrorHandler.java,v 1.3 2001/01/06 06:11:02 stan Exp $
042: package org.xml.sax;
043:
044: /**
045: * Basic interface for SAX error handlers.
046: *
047: * <p>If a SAX application needs to implement customized error
048: * handling, it must implement this interface and then register an
049: * instance with the SAX parser using the parser's setErrorHandler
050: * method. The parser will then report all errors and warnings
051: * through this interface.</p>
052: *
053: * <p> The parser shall use this interface instead of throwing an
054: * exception: it is up to the application whether to throw an
055: * exception for different types of errors and warnings. Note,
056: * however, that there is no requirement that the parser continue to
057: * provide useful information after a call to fatalError (in other
058: * words, a SAX driver class could catch an exception and report a
059: * fatalError).</p>
060: *
061: * <p>The HandlerBase class provides a default implementation of this
062: * interface, ignoring warnings and recoverable errors and throwing a
063: * SAXParseException for fatal errors. An application may extend
064: * that class rather than implementing the complete interface
065: * itself.</p>
066: *
067: * @author David Megginson (ak117@freenet.carleton.ca)
068: * @version 1.0
069: * @see org.xml.sax.Parser#setErrorHandler
070: * @see org.xml.sax.SAXParseException
071: * @see org.xml.sax.HandlerBase
072: */
073: public interface ErrorHandler {
074:
075: /**
076: * Receive notification of a warning.
077: *
078: * <p>SAX parsers will use this method to report conditions that
079: * are not errors or fatal errors as defined by the XML 1.0
080: * recommendation. The default behaviour is to take no action.</p>
081: *
082: * <p>The SAX parser must continue to provide normal parsing events
083: * after invoking this method: it should still be possible for the
084: * application to process the document through to the end.</p>
085: *
086: * @param exception The warning information encapsulated in a
087: * SAX parse exception.
088: * @exception org.xml.sax.SAXException Any SAX exception, possibly
089: * wrapping another exception.
090: * @see org.xml.sax.SAXParseException
091: */
092: public abstract void warning(SAXParseException exception)
093: throws SAXException;
094:
095: /**
096: * Receive notification of a recoverable error.
097: *
098: * <p>This corresponds to the definition of "error" in section 1.2
099: * of the W3C XML 1.0 Recommendation. For example, a validating
100: * parser would use this callback to report the violation of a
101: * validity constraint. The default behaviour is to take no
102: * action.</p>
103: *
104: * <p>The SAX parser must continue to provide normal parsing events
105: * after invoking this method: it should still be possible for the
106: * application to process the document through to the end. If the
107: * application cannot do so, then the parser should report a fatal
108: * error even if the XML 1.0 recommendation does not require it to
109: * do so.</p>
110: *
111: * @param exception The error information encapsulated in a
112: * SAX parse exception.
113: * @exception org.xml.sax.SAXException Any SAX exception, possibly
114: * wrapping another exception.
115: * @see org.xml.sax.SAXParseException
116: */
117: public abstract void error(SAXParseException exception)
118: throws SAXException;
119:
120: /**
121: * Receive notification of a non-recoverable error.
122: *
123: * <p>This corresponds to the definition of "fatal error" in
124: * section 1.2 of the W3C XML 1.0 Recommendation. For example, a
125: * parser would use this callback to report the violation of a
126: * well-formedness constraint.</p>
127: *
128: * <p>The application must assume that the document is unusable
129: * after the parser has invoked this method, and should continue
130: * (if at all) only for the sake of collecting addition error
131: * messages: in fact, SAX parsers are free to stop reporting any
132: * other events once this method has been invoked.</p>
133: *
134: * @param exception The error information encapsulated in a
135: * SAX parse exception.
136: * @exception org.xml.sax.SAXException Any SAX exception, possibly
137: * wrapping another exception.
138: * @see org.xml.sax.SAXParseException
139: */
140: public abstract void fatalError(SAXParseException exception)
141: throws SAXException;
142:
143: }
|