source: icXML/icXML-devel/src/xercesc/framework/XMLEntityHandler.hpp @ 2732

Last change on this file since 2732 was 2722, checked in by cameron, 7 years ago

Original Xerces files with import mods for icxercesc

File size: 5.2 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 /*
19 * $Id: XMLEntityHandler.hpp 527149 2007-04-10 14:56:39Z amassari $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_XMLENTITYHANDLER_HPP)
23#define XERCESC_INCLUDE_GUARD_XMLENTITYHANDLER_HPP
24
25#include <xercesc/util/XercesDefs.hpp>
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29class InputSource;
30class XMLBuffer;
31class XMLResourceIdentifier;
32
33/**
34 *  This abstract class is a callback mechanism for the scanner. By creating
35 *  a derivative of this class and plugging into the scanner, the scanner
36 *  will call back on the object's methods to entity events.
37 *
38 *  This class is primarily for use by those writing their own parser classes.
39 *  If you use the standard parser classes, DOMParser and SAXParser, you won't
40 *  use this API. You will instead use a similar mechanism defined by the SAX
41 *  API, called EntityResolver.
42 */
43class XMLPARSER_EXPORT XMLEntityHandler
44{
45public:
46    // -----------------------------------------------------------------------
47    //  Constructors are hidden, only the virtual destructor is exposed
48    // -----------------------------------------------------------------------
49
50    /** @name Destructor */
51    //@{
52
53    /**
54      * Default destructor
55      */
56    virtual ~XMLEntityHandler()
57    {
58    }
59    //@}
60
61
62    // -----------------------------------------------------------------------
63    //  The virtual entity handler interface
64    // -----------------------------------------------------------------------
65    /** @name The pure virtual methods in this interface. */
66    //@{
67
68    /**
69      * This method get called after the scanner has finished reading from
70      * the given input source while processing external entity references.
71      *
72      * @param inputSource The input source for the entity
73      */
74    virtual void endInputSource(const InputSource& inputSource) = 0;
75
76    /**
77      * This method allows the passes the scanned systemId to the entity
78      * handler, thereby giving it a chance to provide any customized
79      * handling like resolving relative path names. The scanner first
80      * calls this method before calling <code>resolveEntity</code>.
81      *
82      * @param systemId The system id extracted by the scanner from the
83      *                 input source.
84      * @param toFill The buffer in which the fully expanded system id needs
85      *               to be stored.
86      */
87    virtual bool expandSystemId
88    (
89        const   XMLCh* const    systemId
90        ,       XMLBuffer&      toFill
91    ) = 0;
92
93    /**
94      * This method allows the entity handler to reset itself, so that
95      * it can be used again. It is called prior to a new document parse
96      * operation.
97      */
98    virtual void resetEntities() = 0;
99
100    /**
101      * This method allows the entity handler to provide customized
102      * application specific entity resolution.
103      *
104      * <i>Only one resolveEntity method will be used.  If both setEntityResolver and
105      * setXMLEntityResolver are called, then the last one is used.</i>
106      *
107      * @param resourceIdentifier An object containing the type of
108      *        resource to be resolved and the associated data members
109      *        corresponding to this type.
110      * @return The value returned by the resolveEntity method or
111      *         NULL otherwise to indicate no processing was done.
112      *         The returned InputSource is owned by the parser which is
113      *         responsible to clean up the memory.
114      */
115    virtual InputSource* resolveEntity
116    (
117        XMLResourceIdentifier* resourceIdentifier
118    ) = 0;
119
120    /**
121      * This method will be called before the scanner starts reading
122      * from an input source while processing external entity references.
123      *
124      * @param inputSource The external input source.
125      */
126    virtual void startInputSource(const InputSource& inputSource) = 0;
127    //@}
128
129
130protected :
131    // -----------------------------------------------------------------------
132    //  Hidden Constructors
133    // -----------------------------------------------------------------------
134    /** @name Constructor */
135    //@{
136
137    /**
138      * Protected default constructor
139      */
140    XMLEntityHandler()
141    {
142    }
143    //@}
144
145
146
147private:
148    // -----------------------------------------------------------------------
149    //  Unimplemented constructors and destructor
150    // -----------------------------------------------------------------------
151    XMLEntityHandler(const XMLEntityHandler&);
152    XMLEntityHandler& operator=(const XMLEntityHandler&);
153};
154
155XERCES_CPP_NAMESPACE_END
156
157#endif
Note: See TracBrowser for help on using the repository browser.