1 /*
2 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
61 public interface ErrorHandler {
62
63
64 /**
65 * Receive notification of a warning.
66 *
67 * <p>SAX parsers will use this method to report conditions that
68 * are not errors or fatal errors as defined by the XML
69 * recommendation. The default behaviour is to take no
70 * action.</p>
71 *
72 * <p>The SAX parser must continue to provide normal parsing events
73 * after invoking this method: it should still be possible for the
74 * application to process the document through to the end.</p>
75 *
76 * <p>Filters may use this method to report other, non-XML warnings
77 * as well.</p>
78 *
79 * @param exception The warning information encapsulated in a
80 * SAX parse exception.
81 * @exception org.xml.sax.SAXException Any SAX exception, possibly
82 * wrapping another exception.
83 * @see org.xml.sax.SAXParseException
84 */
85 public abstract void warning (SAXParseException exception)
86 throws SAXException;
87
88
89 /**
90 * Receive notification of a recoverable error.
91 *
92 * <p>This corresponds to the definition of "error" in section 1.2
93 * of the W3C XML 1.0 Recommendation. For example, a validating
94 * parser would use this callback to report the violation of a
95 * validity constraint. The default behaviour is to take no
96 * action.</p>
97 *
98 * <p>The SAX parser must continue to provide normal parsing
99 * events after invoking this method: it should still be possible
100 * for the application to process the document through to the end.
101 * If the application cannot do so, then the parser should report
102 * a fatal error even if the XML recommendation does not require
103 * it to do so.</p>
104 *
105 * <p>Filters may use this method to report other, non-XML errors
106 * as well.</p>
107 *
108 * @param exception The error information encapsulated in a
109 * SAX parse exception.
110 * @exception org.xml.sax.SAXException Any SAX exception, possibly
111 * wrapping another exception.
112 * @see org.xml.sax.SAXParseException
113 */
114 public abstract void error (SAXParseException exception)
115 throws SAXException;
116
117
118 /**
119 * Receive notification of a non-recoverable, fatal error.
120 *
121 * <p>
122 * As defined in section 1.2 of the W3C XML 1.0 Recommendation, fatal errors
123 * are those that would make it impossible for a parser to continue normal
124 * processing. These include violation of a well-formedness constraint,
125 * invalid encoding, and forbidden structural errors as described in the
126 * W3C XML 1.0 Recommendation.
127 *
128 * @apiNote An application must assume that the parser can no longer perform
129 * normal processing after reporting a fatal error and may stop by throwing
130 * a {@link SAXException} without calling {@link ContentHandler#endDocument()}.
|
1 /*
2 * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
61 public interface ErrorHandler {
62
63
64 /**
65 * Receive notification of a warning.
66 *
67 * <p>SAX parsers will use this method to report conditions that
68 * are not errors or fatal errors as defined by the XML
69 * recommendation. The default behaviour is to take no
70 * action.</p>
71 *
72 * <p>The SAX parser must continue to provide normal parsing events
73 * after invoking this method: it should still be possible for the
74 * application to process the document through to the end.</p>
75 *
76 * <p>Filters may use this method to report other, non-XML warnings
77 * as well.</p>
78 *
79 * @param exception The warning information encapsulated in a
80 * SAX parse exception.
81 * @throws org.xml.sax.SAXException Any SAX exception, possibly
82 * wrapping another exception.
83 * @see org.xml.sax.SAXParseException
84 */
85 public abstract void warning (SAXParseException exception)
86 throws SAXException;
87
88
89 /**
90 * Receive notification of a recoverable error.
91 *
92 * <p>This corresponds to the definition of "error" in section 1.2
93 * of the W3C XML 1.0 Recommendation. For example, a validating
94 * parser would use this callback to report the violation of a
95 * validity constraint. The default behaviour is to take no
96 * action.</p>
97 *
98 * <p>The SAX parser must continue to provide normal parsing
99 * events after invoking this method: it should still be possible
100 * for the application to process the document through to the end.
101 * If the application cannot do so, then the parser should report
102 * a fatal error even if the XML recommendation does not require
103 * it to do so.</p>
104 *
105 * <p>Filters may use this method to report other, non-XML errors
106 * as well.</p>
107 *
108 * @param exception The error information encapsulated in a
109 * SAX parse exception.
110 * @throws org.xml.sax.SAXException Any SAX exception, possibly
111 * wrapping another exception.
112 * @see org.xml.sax.SAXParseException
113 */
114 public abstract void error (SAXParseException exception)
115 throws SAXException;
116
117
118 /**
119 * Receive notification of a non-recoverable, fatal error.
120 *
121 * <p>
122 * As defined in section 1.2 of the W3C XML 1.0 Recommendation, fatal errors
123 * are those that would make it impossible for a parser to continue normal
124 * processing. These include violation of a well-formedness constraint,
125 * invalid encoding, and forbidden structural errors as described in the
126 * W3C XML 1.0 Recommendation.
127 *
128 * @apiNote An application must assume that the parser can no longer perform
129 * normal processing after reporting a fatal error and may stop by throwing
130 * a {@link SAXException} without calling {@link ContentHandler#endDocument()}.
|