source: NonGTP/Xerces/xerces/include/xercesc/framework/XMLErrorReporter.hpp @ 358

Revision 358, 7.6 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 1999-2001,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 /*
18  * $Log: XMLErrorReporter.hpp,v $
19  * Revision 1.7  2004/09/08 13:55:59  peiyongz
20  * Apache License Version 2.0
21  *
22  * Revision 1.6  2003/03/07 18:08:10  tng
23  * Return a reference instead of void for operator=
24  *
25  * Revision 1.5  2002/12/04 02:32:43  knoaman
26  * #include cleanup.
27  *
28  * Revision 1.4  2002/11/04 15:00:21  tng
29  * C++ Namespace Support.
30  *
31  * Revision 1.3  2002/05/27 18:34:59  tng
32  * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
33  *
34  * Revision 1.2  2002/02/20 18:17:01  tng
35  * [Bug 5977] Warnings on generating apiDocs.
36  *
37  * Revision 1.1.1.1  2002/02/01 22:21:51  peiyongz
38  * sane_include
39  *
40  * Revision 1.11  2001/05/11 13:25:32  tng
41  * Copyright update.
42  *
43  * Revision 1.10  2001/05/03 19:08:56  knoaman
44  * Support Warning/Error/FatalError messaging.
45  * Validity constraints errors are treated as errors, with the ability by user to set
46  * validity constraints as fatal errors.
47  *
48  * Revision 1.9  2000/12/14 18:49:57  tng
49  * Fix API document generation warning: "Warning: end of member group without matching begin"
50  *
51  * Revision 1.8  2000/03/02 19:54:25  roddey
52  * This checkin includes many changes done while waiting for the
53  * 1.1.0 code to be finished. I can't list them all here, but a list is
54  * available elsewhere.
55  *
56  * Revision 1.7  2000/02/24 20:00:23  abagchi
57  * Swat for removing Log from API docs
58  *
59  * Revision 1.6  2000/02/16 23:03:48  roddey
60  * More documentation updates
61  *
62  * Revision 1.5  2000/02/16 21:42:58  aruna1
63  * API Doc++ summary changes in
64  *
65  * Revision 1.4  2000/02/15 23:59:07  roddey
66  * More updated documentation of Framework classes.
67  *
68  * Revision 1.3  2000/02/15 01:21:31  roddey
69  * Some initial documentation improvements. More to come...
70  *
71  * Revision 1.2  2000/02/06 07:47:48  rahulj
72  * Year 2K copyright swat.
73  *
74  * Revision 1.1.1.1  1999/11/09 01:08:34  twl
75  * Initial checkin
76  *
77  * Revision 1.2  1999/11/08 20:44:39  rahul
78  * Swat for adding in Product name and CVS comment log variable.
79  *
80  */
81
82
83#if !defined(XMLERRORREPORTER_HPP)
84#define XMLERRORREPORTER_HPP
85
86#include <xercesc/util/XercesDefs.hpp>
87
88XERCES_CPP_NAMESPACE_BEGIN
89
90
91/**
92 *  This abstract class defines a callback mechanism for the scanner. By
93 *  creating a class that implements this interface and plugging an instance
94 *  of that class into the scanner, the scanner will call back on the object's
95 *  virtual methods to report error events. This class is also used with the
96 *  validator, to allow it to report errors.
97 *
98 *  This class is primarily for use by those writing their own parser classes.
99 *  If you use the standard parser classes, DOMParser and SAXParser, you won't
100 *  use this API. You will instead use a similar mechanism defined by the SAX
101 *  API, called ErrorHandler.
102 */
103class XMLPARSER_EXPORT XMLErrorReporter
104{
105public:
106    // -----------------------------------------------------------------------
107    //  The types of errors we can issue
108    // -----------------------------------------------------------------------
109    enum ErrTypes
110    {
111        ErrType_Warning
112        , ErrType_Error
113        , ErrType_Fatal
114
115        , ErrTypes_Unknown
116    };
117
118
119    // -----------------------------------------------------------------------
120    //  Constructors are hidden, only the virtual destructor is exposed
121    // -----------------------------------------------------------------------
122
123    /** @name Destructor */
124    //@{
125
126    /**
127      *   Default destructor
128      */
129    virtual ~XMLErrorReporter()
130    {
131    }
132    //@}
133
134
135    // -----------------------------------------------------------------------
136    //  The error handler interface
137    // -----------------------------------------------------------------------
138
139    /** @name Error Handler interface */
140    //@{
141
142    /** Called to report errors from the scanner or validator
143      *
144      * This method is called back on by the scanner or validator (or any other
145      * internal parser component which might need to report an error in the
146      * future.) It contains all the information that the client code might
147      * need to report or log the error.
148      *
149      * @param  errCode     The error code of the error being reported. What
150      *                     this means is dependent on the domain it is from.
151      *
152      * @param  errDomain   The domain from which the error occured. The domain
153      *                     is a means of providing a hierarchical layering to
154      *                     the error system, so that a single set of error id
155      *                     numbers don't have to be split up.
156      *
157      * @param  type        The error type, which is defined mostly by XML which
158      *                     categorizes errors into warning, errors and validity
159      *                     constraints.
160      *
161      * @param  errorText   The actual text of the error. This is translatable,
162      *                     so can possibly be in the local language if a
163      *                     translation has been provided.
164      *
165      * @param  systemId    The system id of the entity where the error occured,
166      *                     fully qualified.
167      *
168      * @param  publicId    The optional public id of the entity were the error
169      *                     occured. It can be an empty string if non was provided.
170      *
171      * @param  lineNum     The line number within the source XML of the error.
172      *
173      * @param  colNum      The column number within the source XML of the error.
174      *                     Because of the parsing style, this is usually just
175      *                     after the actual offending text.
176      */
177    virtual void error
178    (
179        const   unsigned int        errCode
180        , const XMLCh* const        errDomain
181        , const ErrTypes            type
182        , const XMLCh* const        errorText
183        , const XMLCh* const        systemId
184        , const XMLCh* const        publicId
185        , const XMLSSize_t          lineNum
186        , const XMLSSize_t          colNum
187    ) = 0;
188
189    /** Called before a new parse event to allow the handler to reset
190      *
191      * This method is called by the scanner before a new parse event is
192      * about to start. It gives the error handler a chance to reset its
193      * internal state.
194      */
195    virtual void resetErrors() = 0;
196
197    //@}
198
199
200protected :
201
202    /** @name Constructor */
203    //@{
204
205    /**
206      *   Default constructor
207      */
208    XMLErrorReporter()
209    {
210    }
211    //@}
212
213private:
214    // -----------------------------------------------------------------------
215    //  Unimplemented constructors and destructor
216    // -----------------------------------------------------------------------
217    XMLErrorReporter(const XMLErrorReporter&);
218    XMLErrorReporter& operator=(const XMLErrorReporter&);
219};
220
221XERCES_CPP_NAMESPACE_END
222
223#endif
Note: See TracBrowser for help on using the repository browser.