Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:27:05

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018  /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_XMLERRORREPORTER_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XMLERRORREPORTER_HPP
0024 
0025 #include <xercesc/util/XercesDefs.hpp>
0026 
0027 XERCES_CPP_NAMESPACE_BEGIN
0028 
0029 
0030 /**
0031  *  This abstract class defines a callback mechanism for the scanner. By
0032  *  creating a class that implements this interface and plugging an instance
0033  *  of that class into the scanner, the scanner will call back on the object's
0034  *  virtual methods to report error events. This class is also used with the
0035  *  validator, to allow it to report errors.
0036  *
0037  *  This class is primarily for use by those writing their own parser classes.
0038  *  If you use the standard parser classes, DOMParser and SAXParser, you won't
0039  *  use this API. You will instead use a similar mechanism defined by the SAX
0040  *  API, called ErrorHandler.
0041  */
0042 class XMLPARSER_EXPORT XMLErrorReporter
0043 {
0044 public:
0045     // -----------------------------------------------------------------------
0046     //  The types of errors we can issue
0047     // -----------------------------------------------------------------------
0048     enum ErrTypes
0049     {
0050         ErrType_Warning
0051         , ErrType_Error
0052         , ErrType_Fatal
0053 
0054         , ErrTypes_Unknown
0055     };
0056 
0057 
0058     // -----------------------------------------------------------------------
0059     //  Constructors are hidden, only the virtual destructor is exposed
0060     // -----------------------------------------------------------------------
0061 
0062     /** @name Destructor */
0063     //@{
0064 
0065     /**
0066       *   Default destructor
0067       */
0068     virtual ~XMLErrorReporter()
0069     {
0070     }
0071     //@}
0072 
0073 
0074     // -----------------------------------------------------------------------
0075     //  The error handler interface
0076     // -----------------------------------------------------------------------
0077 
0078     /** @name Error Handler interface */
0079     //@{
0080 
0081     /** Called to report errors from the scanner or validator
0082       *
0083       * This method is called back on by the scanner or validator (or any other
0084       * internal parser component which might need to report an error in the
0085       * future.) It contains all the information that the client code might
0086       * need to report or log the error.
0087       *
0088       * @param  errCode     The error code of the error being reported. What
0089       *                     this means is dependent on the domain it is from.
0090       *
0091       * @param  errDomain   The domain from which the error occured. The domain
0092       *                     is a means of providing a hierarchical layering to
0093       *                     the error system, so that a single set of error id
0094       *                     numbers don't have to be split up.
0095       *
0096       * @param  type        The error type, which is defined mostly by XML which
0097       *                     categorizes errors into warning, errors and validity
0098       *                     constraints.
0099       *
0100       * @param  errorText   The actual text of the error. This is translatable,
0101       *                     so can possibly be in the local language if a
0102       *                     translation has been provided.
0103       *
0104       * @param  systemId    The system id of the entity where the error occured,
0105       *                     fully qualified.
0106       *
0107       * @param  publicId    The optional public id of the entity were the error
0108       *                     occured. It can be an empty string if non was provided.
0109       *
0110       * @param  lineNum     The line number within the source XML of the error.
0111       *
0112       * @param  colNum      The column number within the source XML of the error.
0113       *                     Because of the parsing style, this is usually just
0114       *                     after the actual offending text.
0115       */
0116     virtual void error
0117     (
0118         const   unsigned int        errCode
0119         , const XMLCh* const        errDomain
0120         , const ErrTypes            type
0121         , const XMLCh* const        errorText
0122         , const XMLCh* const        systemId
0123         , const XMLCh* const        publicId
0124         , const XMLFileLoc          lineNum
0125         , const XMLFileLoc          colNum
0126     ) = 0;
0127 
0128     /** Called before a new parse event to allow the handler to reset
0129       *
0130       * This method is called by the scanner before a new parse event is
0131       * about to start. It gives the error handler a chance to reset its
0132       * internal state.
0133       */
0134     virtual void resetErrors() = 0;
0135 
0136     //@}
0137 
0138 
0139 protected :
0140 
0141     /** @name Constructor */
0142     //@{
0143 
0144     /**
0145       *   Default constructor
0146       */
0147     XMLErrorReporter()
0148     {
0149     }
0150     //@}
0151 
0152 private:
0153     // -----------------------------------------------------------------------
0154     //  Unimplemented constructors and destructor
0155     // -----------------------------------------------------------------------
0156     XMLErrorReporter(const XMLErrorReporter&);
0157     XMLErrorReporter& operator=(const XMLErrorReporter&);
0158 };
0159 
0160 XERCES_CPP_NAMESPACE_END
0161 
0162 #endif