KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > css > sac > ErrorHandler


1 /*
2  * Copyright (c) 1999 World Wide Web Consortium
3  * (Massachusetts Institute of Technology, Institut National de Recherche
4  * en Informatique et en Automatique, Keio University).
5  * All Rights Reserved. http://www.w3.org/Consortium/Legal/
6  *
7  * The original version of this interface comes from SAX :
8  * http://www.megginson.com/SAX/
9  *
10  * $Id: ErrorHandler.java,v 1.1.1.1 2003/12/28 21:23:48 davidsch Exp $
11  */

12 package org.w3c.css.sac;
13
14 /**
15   * Basic interface for CSS error handlers.
16   *
17   * <p>If a CSS application needs to implement customized error
18   * handling, it must implement this interface and then register an
19   * instance with the CSS parser using the parser's setErrorHandler
20   * method. The parser will then report all errors and warnings
21   * through this interface.</p>
22   *
23   * <p> The parser shall use this interface instead of throwing an
24   * exception: it is up to the application whether to throw an
25   * exception for different types of errors and warnings. Note,
26   * however, that there is no requirement that the parser continue to
27   * provide useful information after a call to fatalError (in other
28   * words, a CSS driver class could catch an exception and report a
29   * fatalError).</p>
30   *
31   * <p>The HandlerBase class provides a default implementation of this
32   * interface, ignoring warnings and recoverable errors and throwing a
33   * SAXParseException for fatal errors. An application may extend
34   * that class rather than implementing the complete interface
35   * itself.</p>
36   *
37  * @version $Revision: 1.1.1.1 $
38  * @author Philippe Le Hegaret
39   */

40 public interface ErrorHandler {
41
42
43   /**
44     * Receive notification of a warning.
45     *
46     * <p>CSS parsers will use this method to report conditions that
47     * are not errors or fatal errors as defined by the XML 1.0
48     * recommendation. The default behaviour is to take no action.</p>
49     *
50     * <p>The CSS parser must continue to provide normal parsing events
51     * after invoking this method: it should still be possible for the
52     * application to process the document through to the end.</p>
53     *
54     * @param exception The warning information encapsulated in a
55     * CSS parse exception.
56     * @exception CSSException Any CSS exception, possibly
57     * wrapping another exception.
58     * @see CSSParseException
59     */

60   public void warning(CSSParseException exception) throws CSSException;
61
62   /**
63     * Receive notification of a recoverable error.
64     *
65     * <p>This corresponds to the definition of "error" in section 1.2
66     * of the W3C XML 1.0 Recommendation. For example, a validating
67     * parser would use this callback to report the violation of a
68     * validity constraint. The default behaviour is to take no
69     * action.</p>
70     *
71     * <p>The CSS parser must continue to provide normal parsing events
72     * after invoking this method: it should still be possible for the
73     * application to process the document through to the end. If the
74     * application cannot do so, then the parser should report a fatal
75     * error even if the XML 1.0 recommendation does not require it to
76     * do so.</p>
77     *
78     * @param exception The error information encapsulated in a
79     * CSS parse exception.
80     * @exception CSSException Any CSS exception, possibly
81     * wrapping another exception.
82     * @see CSSParseException
83     */

84   public void error(CSSParseException exception) throws CSSException;
85
86   /**
87     * Receive notification of a non-recoverable error.
88     *
89     * <p>This corresponds to the definition of "fatal error" in
90     * section 1.2 of the W3C XML 1.0 Recommendation. For example, a
91     * parser would use this callback to report the violation of a
92     * well-formedness constraint.</p>
93     *
94     * <p>The application must assume that the document is unusable
95     * after the parser has invoked this method, and should continue
96     * (if at all) only for the sake of collecting addition error
97     * messages: in fact, CSS parsers are free to stop reporting any
98     * other events once this method has been invoked.</p>
99     *
100     * @param exception The error information encapsulated in a
101     * CSS parse exception.
102     * @exception CSSException Any CSS exception, possibly
103     * wrapping another exception.
104     * @see CSSParseException
105     */

106   public void fatalError(CSSParseException exception) throws CSSException;
107
108 }
109
Popular Tags