source: NonGTP/Xerces/xercesc/framework/XMLErrorReporter.hpp @ 188

Revision 188, 9.6 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1/*
2 * The Apache Software License, Version 1.1
3 *
4 * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
5 * reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in
16 *    the documentation and/or other materials provided with the
17 *    distribution.
18 *
19 * 3. The end-user documentation included with the redistribution,
20 *    if any, must include the following acknowledgment:
21 *       "This product includes software developed by the
22 *        Apache Software Foundation (http://www.apache.org/)."
23 *    Alternately, this acknowledgment may appear in the software itself,
24 *    if and wherever such third-party acknowledgments normally appear.
25 *
26 * 4. The names "Xerces" and "Apache Software Foundation" must
27 *    not be used to endorse or promote products derived from this
28 *    software without prior written permission. For written
29 *    permission, please contact apache\@apache.org.
30 *
31 * 5. Products derived from this software may not be called "Apache",
32 *    nor may "Apache" appear in their name, without prior written
33 *    permission of the Apache Software Foundation.
34 *
35 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 * SUCH DAMAGE.
47 * ====================================================================
48 *
49 * This software consists of voluntary contributions made by many
50 * individuals on behalf of the Apache Software Foundation, and was
51 * originally based on software copyright (c) 1999, International
52 * Business Machines, Inc., http://www.ibm.com .  For more information
53 * on the Apache Software Foundation, please see
54 * <http://www.apache.org/>.
55 */
56
57 /*
58  * $Log: XMLErrorReporter.hpp,v $
59  * Revision 1.6  2003/03/07 18:08:10  tng
60  * Return a reference instead of void for operator=
61  *
62  * Revision 1.5  2002/12/04 02:32:43  knoaman
63  * #include cleanup.
64  *
65  * Revision 1.4  2002/11/04 15:00:21  tng
66  * C++ Namespace Support.
67  *
68  * Revision 1.3  2002/05/27 18:34:59  tng
69  * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
70  *
71  * Revision 1.2  2002/02/20 18:17:01  tng
72  * [Bug 5977] Warnings on generating apiDocs.
73  *
74  * Revision 1.1.1.1  2002/02/01 22:21:51  peiyongz
75  * sane_include
76  *
77  * Revision 1.11  2001/05/11 13:25:32  tng
78  * Copyright update.
79  *
80  * Revision 1.10  2001/05/03 19:08:56  knoaman
81  * Support Warning/Error/FatalError messaging.
82  * Validity constraints errors are treated as errors, with the ability by user to set
83  * validity constraints as fatal errors.
84  *
85  * Revision 1.9  2000/12/14 18:49:57  tng
86  * Fix API document generation warning: "Warning: end of member group without matching begin"
87  *
88  * Revision 1.8  2000/03/02 19:54:25  roddey
89  * This checkin includes many changes done while waiting for the
90  * 1.1.0 code to be finished. I can't list them all here, but a list is
91  * available elsewhere.
92  *
93  * Revision 1.7  2000/02/24 20:00:23  abagchi
94  * Swat for removing Log from API docs
95  *
96  * Revision 1.6  2000/02/16 23:03:48  roddey
97  * More documentation updates
98  *
99  * Revision 1.5  2000/02/16 21:42:58  aruna1
100  * API Doc++ summary changes in
101  *
102  * Revision 1.4  2000/02/15 23:59:07  roddey
103  * More updated documentation of Framework classes.
104  *
105  * Revision 1.3  2000/02/15 01:21:31  roddey
106  * Some initial documentation improvements. More to come...
107  *
108  * Revision 1.2  2000/02/06 07:47:48  rahulj
109  * Year 2K copyright swat.
110  *
111  * Revision 1.1.1.1  1999/11/09 01:08:34  twl
112  * Initial checkin
113  *
114  * Revision 1.2  1999/11/08 20:44:39  rahul
115  * Swat for adding in Product name and CVS comment log variable.
116  *
117  */
118
119
120#if !defined(XMLERRORREPORTER_HPP)
121#define XMLERRORREPORTER_HPP
122
123#include <xercesc/util/XercesDefs.hpp>
124
125XERCES_CPP_NAMESPACE_BEGIN
126
127
128/**
129 *  This abstract class defines a callback mechanism for the scanner. By
130 *  creating a class that implements this interface and plugging an instance
131 *  of that class into the scanner, the scanner will call back on the object's
132 *  virtual methods to report error events. This class is also used with the
133 *  validator, to allow it to report errors.
134 *
135 *  This class is primarily for use by those writing their own parser classes.
136 *  If you use the standard parser classes, DOMParser and SAXParser, you won't
137 *  use this API. You will instead use a similar mechanism defined by the SAX
138 *  API, called ErrorHandler.
139 */
140class XMLPARSER_EXPORT XMLErrorReporter
141{
142public:
143    // -----------------------------------------------------------------------
144    //  The types of errors we can issue
145    // -----------------------------------------------------------------------
146    enum ErrTypes
147    {
148        ErrType_Warning
149        , ErrType_Error
150        , ErrType_Fatal
151
152        , ErrTypes_Unknown
153    };
154
155
156    // -----------------------------------------------------------------------
157    //  Constructors are hidden, only the virtual destructor is exposed
158    // -----------------------------------------------------------------------
159
160    /** @name Destructor */
161    //@{
162
163    /**
164      *   Default destructor
165      */
166    virtual ~XMLErrorReporter()
167    {
168    }
169    //@}
170
171
172    // -----------------------------------------------------------------------
173    //  The error handler interface
174    // -----------------------------------------------------------------------
175
176    /** @name Error Handler interface */
177    //@{
178
179    /** Called to report errors from the scanner or validator
180      *
181      * This method is called back on by the scanner or validator (or any other
182      * internal parser component which might need to report an error in the
183      * future.) It contains all the information that the client code might
184      * need to report or log the error.
185      *
186      * @param  errCode     The error code of the error being reported. What
187      *                     this means is dependent on the domain it is from.
188      *
189      * @param  errDomain   The domain from which the error occured. The domain
190      *                     is a means of providing a hierarchical layering to
191      *                     the error system, so that a single set of error id
192      *                     numbers don't have to be split up.
193      *
194      * @param  type        The error type, which is defined mostly by XML which
195      *                     categorizes errors into warning, errors and validity
196      *                     constraints.
197      *
198      * @param  errorText   The actual text of the error. This is translatable,
199      *                     so can possibly be in the local language if a
200      *                     translation has been provided.
201      *
202      * @param  systemId    The system id of the entity where the error occured,
203      *                     fully qualified.
204      *
205      * @param  publicId    The optional public id of the entity were the error
206      *                     occured. It can be an empty string if non was provided.
207      *
208      * @param  lineNum     The line number within the source XML of the error.
209      *
210      * @param  colNum      The column number within the source XML of the error.
211      *                     Because of the parsing style, this is usually just
212      *                     after the actual offending text.
213      */
214    virtual void error
215    (
216        const   unsigned int        errCode
217        , const XMLCh* const        errDomain
218        , const ErrTypes            type
219        , const XMLCh* const        errorText
220        , const XMLCh* const        systemId
221        , const XMLCh* const        publicId
222        , const XMLSSize_t          lineNum
223        , const XMLSSize_t          colNum
224    ) = 0;
225
226    /** Called before a new parse event to allow the handler to reset
227      *
228      * This method is called by the scanner before a new parse event is
229      * about to start. It gives the error handler a chance to reset its
230      * internal state.
231      */
232    virtual void resetErrors() = 0;
233
234    //@}
235
236
237protected :
238
239    /** @name Constructor */
240    //@{
241
242    /**
243      *   Default constructor
244      */
245    XMLErrorReporter()
246    {
247    }
248    //@}
249
250private:
251    // -----------------------------------------------------------------------
252    //  Unimplemented constructors and destructor
253    // -----------------------------------------------------------------------
254    XMLErrorReporter(const XMLErrorReporter&);
255    XMLErrorReporter& operator=(const XMLErrorReporter&);
256};
257
258XERCES_CPP_NAMESPACE_END
259
260#endif
Note: See TracBrowser for help on using the repository browser.