source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/dom/DOMEntityResolver.hpp @ 2674

Revision 2674, 5.4 KB checked in by mattausch, 16 years ago (diff)
Line 
1#ifndef DOMEntityResolver_HEADER_GUARD_
2#define DOMEntityResolver_HEADER_GUARD_
3
4/*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements.  See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License.  You may obtain a copy of the License at
11 *
12 *      http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21/*
22 * $Id: DOMEntityResolver.hpp 568078 2007-08-21 11:43:25Z amassari $
23 */
24
25
26#include <xercesc/util/XercesDefs.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30
31class DOMInputSource;
32
33/**
34  * DOMEntityResolver provides a way for applications to redirect references
35  * to external entities.
36  *
37  * <p>Applications needing to implement customized handling for external
38  * entities must implement this interface and register their implementation
39  * by setting the entityResolver attribute of the DOMBuilder.</p>
40  *
41  * <p>The DOMBuilder will then allow the application to intercept any
42  * external entities (including the external DTD subset and external parameter
43  * entities) before including them.</p>
44  *
45  * <p>Many DOM applications will not need to implement this interface, but it
46  * will be especially useful for applications that build XML documents from
47  * databases or other specialized input sources, or for applications that use
48  * URNs.</p>
49  *
50  * @see DOMBuilder#setEntityResolver
51  * @see DOMInputSource#DOMInputSource
52  * @since DOM Level 3
53  */
54class CDOM_EXPORT DOMEntityResolver
55{
56protected:
57    // -----------------------------------------------------------------------
58    //  Hidden constructors
59    // -----------------------------------------------------------------------
60    /** @name Hidden constructors */
61    //@{   
62    DOMEntityResolver() {};
63    //@}
64
65private:
66    // -----------------------------------------------------------------------
67    // Unimplemented constructors and operators
68    // -----------------------------------------------------------------------
69    /** @name Unimplemented constructors and operators */
70    //@{
71    DOMEntityResolver(const DOMEntityResolver &);
72    DOMEntityResolver & operator = (const DOMEntityResolver &);
73    //@}
74
75public:
76    // -----------------------------------------------------------------------
77    //  All constructors are hidden, just the destructor is available
78    // -----------------------------------------------------------------------
79    /** @name Destructor */
80    //@{
81    /**
82     * Destructor
83     *
84     */
85    virtual ~DOMEntityResolver() {};
86    //@}
87
88    // -----------------------------------------------------------------------
89    //  Virtual DOMEntityResolver interface
90    // -----------------------------------------------------------------------
91    /** @name Functions introduced in DOM Level 2 */
92    //@{
93    /**
94     * Allow the application to resolve external entities.
95     *
96     * <p>The DOMBuilder will call this method before opening any external
97     * entity except the top-level document entity (including the
98     * external DTD subset, external entities referenced within the
99     * DTD, and external entities referenced within the document
100     * element): the application may request that the DOMBuilder resolve
101     * the entity itself, that it use an alternative URI, or that it
102     * use an entirely different input source.</p>
103     *
104     * <p>Application writers can use this method to redirect external
105     * system identifiers to secure and/or local URIs, to look up
106     * public identifiers in a catalogue, or to read an entity from a
107     * database or other input source (including, for example, a dialog
108     * box).</p>
109     *
110     * <p>If the system identifier is a URL, the DOMBuilder parser must
111     * resolve it fully before reporting it to the application.</p>
112     *
113     * <p> The returned DOMInputSource is owned by the DOMBuilder which is
114     *     responsible to clean up the memory.
115     *
116     * <p><b>"Experimental - subject to change"</b></p>
117     *
118     * @param publicId The public identifier of the external entity
119     *        being referenced, or null if none was supplied.
120     * @param systemId The system identifier of the external entity
121     *        being referenced.
122     * @param baseURI The absolute base URI of the resource being parsed, or
123     *        <code>null</code> if there is no base URI.
124     * @return A DOMInputSource object describing the new input source,
125     *         or <code>null</code> to request that the parser open a regular
126     *         URI connection to the system identifier.
127     *         The returned DOMInputSource is owned by the DOMBuilder which is
128     *         responsible to clean up the memory.
129     * @see DOMInputSource#DOMInputSource
130     * @since DOM Level 3
131     */
132    virtual DOMInputSource* resolveEntity
133    (
134        const   XMLCh* const    publicId
135        , const XMLCh* const    systemId
136        , const XMLCh* const    baseURI
137    ) = 0;
138
139    //@}
140
141};
142
143XERCES_CPP_NAMESPACE_END
144
145#endif
Note: See TracBrowser for help on using the repository browser.