Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:53

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_XMLENTITYHANDLER_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XMLENTITYHANDLER_HPP
0024 
0025 #include <xercesc/util/XercesDefs.hpp>
0026 
0027 XERCES_CPP_NAMESPACE_BEGIN
0028 
0029 class InputSource;
0030 class XMLBuffer;
0031 class XMLResourceIdentifier;
0032 
0033 /**
0034  *  This abstract class is a callback mechanism for the scanner. By creating
0035  *  a derivative of this class and plugging into the scanner, the scanner
0036  *  will call back on the object's methods to entity events.
0037  *
0038  *  This class is primarily for use by those writing their own parser classes.
0039  *  If you use the standard parser classes, DOMParser and SAXParser, you won't
0040  *  use this API. You will instead use a similar mechanism defined by the SAX
0041  *  API, called EntityResolver.
0042  */
0043 class XMLPARSER_EXPORT XMLEntityHandler
0044 {
0045 public:
0046     // -----------------------------------------------------------------------
0047     //  Constructors are hidden, only the virtual destructor is exposed
0048     // -----------------------------------------------------------------------
0049 
0050     /** @name Destructor */
0051     //@{
0052 
0053     /**
0054       * Default destructor
0055       */
0056     virtual ~XMLEntityHandler()
0057     {
0058     }
0059     //@}
0060 
0061 
0062     // -----------------------------------------------------------------------
0063     //  The virtual entity handler interface
0064     // -----------------------------------------------------------------------
0065     /** @name The pure virtual methods in this interface. */
0066     //@{
0067 
0068     /**
0069       * This method get called after the scanner has finished reading from
0070       * the given input source while processing external entity references.
0071       *
0072       * @param inputSource The input source for the entity
0073       */
0074     virtual void endInputSource(const InputSource& inputSource) = 0;
0075 
0076     /**
0077       * This method allows the passes the scanned systemId to the entity
0078       * handler, thereby giving it a chance to provide any customized
0079       * handling like resolving relative path names. The scanner first
0080       * calls this method before calling <code>resolveEntity</code>.
0081       *
0082       * @param systemId The system id extracted by the scanner from the
0083       *                 input source.
0084       * @param toFill The buffer in which the fully expanded system id needs
0085       *               to be stored.
0086       */
0087     virtual bool expandSystemId
0088     (
0089         const   XMLCh* const    systemId
0090         ,       XMLBuffer&      toFill
0091     ) = 0;
0092 
0093     /**
0094       * This method allows the entity handler to reset itself, so that
0095       * it can be used again. It is called prior to a new document parse
0096       * operation.
0097       */
0098     virtual void resetEntities() = 0;
0099 
0100     /**
0101       * This method allows the entity handler to provide customized
0102       * application specific entity resolution. 
0103       *
0104       * <i>Only one resolveEntity method will be used.  If both setEntityResolver and 
0105       * setXMLEntityResolver are called, then the last one is used.</i>
0106       *
0107       * @param resourceIdentifier An object containing the type of
0108       *        resource to be resolved and the associated data members
0109       *        corresponding to this type.
0110       * @return The value returned by the resolveEntity method or
0111       *         NULL otherwise to indicate no processing was done.
0112       *         The returned InputSource is owned by the parser which is
0113       *         responsible to clean up the memory.
0114       */
0115     virtual InputSource* resolveEntity
0116     (
0117         XMLResourceIdentifier* resourceIdentifier
0118     ) = 0;
0119 
0120     /**
0121       * This method will be called before the scanner starts reading
0122       * from an input source while processing external entity references.
0123       *
0124       * @param inputSource The external input source.
0125       */
0126     virtual void startInputSource(const InputSource& inputSource) = 0;
0127     //@}
0128 
0129 
0130 protected :
0131     // -----------------------------------------------------------------------
0132     //  Hidden Constructors
0133     // -----------------------------------------------------------------------
0134     /** @name Constructor */
0135     //@{
0136 
0137     /**
0138       * Protected default constructor
0139       */
0140     XMLEntityHandler()
0141     {
0142     }
0143     //@}
0144 
0145 
0146 
0147 private:
0148     // -----------------------------------------------------------------------
0149     //  Unimplemented constructors and destructor
0150     // -----------------------------------------------------------------------
0151     XMLEntityHandler(const XMLEntityHandler&);
0152     XMLEntityHandler& operator=(const XMLEntityHandler&);
0153 };
0154 
0155 XERCES_CPP_NAMESPACE_END
0156 
0157 #endif