KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > xni > parser > XMLErrorHandler


1 /*
2  * Copyright 2001, 2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.xni.parser;
18
19 import org.apache.xerces.xni.XNIException;
20
21 /**
22  * An interface for handling errors. If the application is interested
23  * in error notifications, then it can register an error handler object
24  * that implements this interface with the parser configuration.
25  *
26  * @see XMLParserConfiguration
27  *
28  * @author Andy Clark, IBM
29  *
30  * @version $Id: XMLErrorHandler.java,v 1.4 2004/02/24 23:15:56 mrglavas Exp $
31  */

32 public interface XMLErrorHandler {
33
34     //
35
// XMLErrorHandler methods
36
//
37

38     /**
39      * Reports a warning. Warnings are non-fatal and can be safely ignored
40      * by most applications.
41      *
42      * @param domain The domain of the warning. The domain can be any
43      * string but is suggested to be a valid URI. The
44      * domain can be used to conveniently specify a web
45      * site location of the relevent specification or
46      * document pertaining to this warning.
47      * @param key The warning key. This key can be any string and
48      * is implementation dependent.
49      * @param exception Exception.
50      *
51      * @throws XNIException Thrown to signal that the parser should stop
52      * parsing the document.
53      */

54     public void warning(String JavaDoc domain, String JavaDoc key,
55                         XMLParseException exception) throws XNIException;
56
57     /**
58      * Reports an error. Errors are non-fatal and usually signify that the
59      * document is invalid with respect to its grammar(s).
60      *
61      * @param domain The domain of the error. The domain can be any
62      * string but is suggested to be a valid URI. The
63      * domain can be used to conveniently specify a web
64      * site location of the relevent specification or
65      * document pertaining to this error.
66      * @param key The error key. This key can be any string and
67      * is implementation dependent.
68      * @param exception Exception.
69      *
70      * @throws XNIException Thrown to signal that the parser should stop
71      * parsing the document.
72      */

73     public void error(String JavaDoc domain, String JavaDoc key,
74                       XMLParseException exception) throws XNIException;
75
76     /**
77      * Report a fatal error. Fatal errors usually occur when the document
78      * is not well-formed and signifies that the parser cannot continue
79      * normal operation.
80      * <p>
81      * <strong>Note:</strong> The error handler should <em>always</em>
82      * throw an <code>XNIException</code> from this method. This exception
83      * can either be the same exception that is passed as a parameter to
84      * the method or a new XNI exception object. If the registered error
85      * handler fails to throw an exception, the continuing operation of
86      * the parser is undetermined.
87      *
88      * @param domain The domain of the fatal error. The domain can be
89      * any string but is suggested to be a valid URI. The
90      * domain can be used to conveniently specify a web
91      * site location of the relevent specification or
92      * document pertaining to this fatal error.
93      * @param key The fatal error key. This key can be any string
94      * and is implementation dependent.
95      * @param exception Exception.
96      *
97      * @throws XNIException Thrown to signal that the parser should stop
98      * parsing the document.
99      */

100     public void fatalError(String JavaDoc domain, String JavaDoc key,
101                            XMLParseException exception) throws XNIException;
102
103 } // interface XMLErrorHandler
104
Popular Tags