source: NonGTP/Xerces/xercesc/dom/DOMInputSource.hpp @ 188

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

added xercesc to support

Line 
1#ifndef DOMInputSource_HEADER_GUARD_
2#define DOMInputSource_HEADER_GUARD_
3
4/*
5 * The Apache Software License, Version 1.1
6 *
7 * Copyright (c) 2002 The Apache Software Foundation.  All rights
8 * reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above copyright
18 *    notice, this list of conditions and the following disclaimer in
19 *    the documentation and/or other materials provided with the
20 *    distribution.
21 *
22 * 3. The end-user documentation included with the redistribution,
23 *    if any, must include the following acknowledgment:
24 *       "This product includes software developed by the
25 *        Apache Software Foundation (http://www.apache.org/)."
26 *    Alternately, this acknowledgment may appear in the software itself,
27 *    if and wherever such third-party acknowledgments normally appear.
28 *
29 * 4. The names "Xerces" and "Apache Software Foundation" must
30 *    not be used to endorse or promote products derived from this
31 *    software without prior written permission. For written
32 *    permission, please contact apache\@apache.org.
33 *
34 * 5. Products derived from this software may not be called "Apache",
35 *    nor may "Apache" appear in their name, without prior written
36 *    permission of the Apache Software Foundation.
37 *
38 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
39 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
42 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
45 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
46 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
48 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49 * SUCH DAMAGE.
50 * ====================================================================
51 *
52 * This software consists of voluntary contributions made by many
53 * individuals on behalf of the Apache Software Foundation, and was
54 * originally based on software copyright (c) 1999, International
55 * Business Machines, Inc., http://www.ibm.com .  For more information
56 * on the Apache Software Foundation, please see
57 * <http://www.apache.org/>.
58 */
59
60/*
61 * $Id: DOMInputSource.hpp,v 1.10 2003/05/30 16:11:43 gareth Exp $
62 */
63
64
65#include <xercesc/util/XercesDefs.hpp>
66
67XERCES_CPP_NAMESPACE_BEGIN
68
69
70class BinInputStream;
71
72
73/**
74  * This interface represents a single input source for an XML entity.
75  *
76  * <p>This interface allows an application to encapsulate information about
77  * an input source in a single object, which may include a public identifier,
78  * a system identifier, a byte stream (possibly with a specified encoding),
79  * and/or a character stream.</p>
80  *
81  * <p>There are two places that the application will deliver this input source
82  * to the parser: as the argument to the parse method, or as the return value
83  * of the DOMEntityResolver.resolveEntity method.</p>
84  *
85  * <p>The DOMBuilder will use the DOMInputSource object to determine how to
86  * read XML input. If there is a character stream available, the parser will
87  * read that stream directly; if not, the parser will use a byte stream, if
88  * available; if neither a character stream nor a byte stream is available,
89  * the parser will attempt to open a URI connection to the resource identified
90  * by the system identifier.</p>
91  *
92  * <p>A DOMInputSource object belongs to the application: the parser shall
93  * never modify it in any way (it may modify a copy if necessary).</p>
94  *
95  * @see DOMBuilder#parse
96  * @see DOMEntityResolver#resolveEntity
97  * @since DOM Level 3
98  */
99class CDOM_EXPORT DOMInputSource
100{
101protected:
102    // -----------------------------------------------------------------------
103    //  Hidden constructors
104    // -----------------------------------------------------------------------
105    /** @name Hidden constructors */
106    //@{   
107    DOMInputSource() {};
108    //@}
109
110private:
111    // -----------------------------------------------------------------------
112    // Unimplemented constructors and operators
113    // -----------------------------------------------------------------------
114    /** @name Unimplemented constructors and operators */
115    //@{
116    DOMInputSource(const DOMInputSource &);
117    DOMInputSource & operator = (const DOMInputSource &);
118    //@}
119
120public:
121    // -----------------------------------------------------------------------
122    //  All constructors are hidden, just the destructor is available
123    // -----------------------------------------------------------------------
124    /** @name Destructor */
125    //@{
126    /**
127     * Destructor
128     *
129     */
130    virtual ~DOMInputSource() {};
131    //@}
132
133    // -----------------------------------------------------------------------
134    //  Virtual DOMInputSource interface
135    // -----------------------------------------------------------------------
136    /** @name Functions introduced in DOM Level 3 */
137    //@{
138    // -----------------------------------------------------------------------
139    //  Getter methods
140    // -----------------------------------------------------------------------
141    /**
142     * An input source can be set to force the parser to assume a particular
143     * encoding for the data that input source reprsents, via the setEncoding()
144     * method. This method returns name of the encoding that is to be forced.
145     * If the encoding has never been forced, it returns a null pointer.
146     *
147     * <p><b>"Experimental - subject to change"</b></p>
148     *
149     * @return The forced encoding, or null if none was supplied.
150     * @see #setEncoding
151     * @since DOM Level 3
152     */
153    virtual const XMLCh* getEncoding() const = 0;
154
155
156    /**
157     * Get the public identifier for this input source.
158     *
159     * <p><b>"Experimental - subject to change"</b></p>
160     *
161     * @return The public identifier, or null if none was supplied.
162     * @see #setPublicId
163     * @since DOM Level 3
164     */
165    virtual const XMLCh* getPublicId() const = 0;
166
167
168    /**
169     * Get the system identifier for this input source.
170     *
171     * <p><b>"Experimental - subject to change"</b></p>
172     *
173     * <p>If the system ID is a URL, it will be fully resolved.</p>
174     *
175     * @return The system identifier.
176     * @see #setSystemId
177     * @since DOM Level 3
178     */
179    virtual const XMLCh* getSystemId() const = 0;
180
181
182    /**
183     * Get the base URI to be used for resolving relative URIs to absolute
184     * URIs. If the baseURI is itself a relative URI, the behavior is
185     * implementation dependent.
186     *
187     * <p><b>"Experimental - subject to change"</b></p>
188     *
189     * @return The base URI.
190     * @see #setBaseURI
191     * @since DOM Level 3
192     */
193    virtual const XMLCh* getBaseURI() const = 0;
194
195    // -----------------------------------------------------------------------
196    //  Setter methods
197    // -----------------------------------------------------------------------
198    /**
199     * Set the encoding which will be required for use with the XML text read
200     * via a stream opened by this input source.
201     *
202     * <p>This is usually not set, allowing the encoding to be sensed in the
203     * usual XML way. However, in some cases, the encoding in the file is known
204     * to be incorrect because of intermediate transcoding, for instance
205     * encapsulation within a MIME document.
206     *
207     * <p><b>"Experimental - subject to change"</b></p>
208     *
209     * @param encodingStr The name of the encoding to force.
210     * @since DOM Level 3
211     */
212    virtual void setEncoding(const XMLCh* const encodingStr) = 0;
213
214
215    /**
216     * Set the public identifier for this input source.
217     *
218     * <p>The public identifier is always optional: if the application writer
219     * includes one, it will be provided as part of the location information.</p>
220     *
221     * <p><b>"Experimental - subject to change"</b></p>
222     *
223     * @param publicId The public identifier as a string.
224     * @see #getPublicId
225     * @since DOM Level 3
226     */
227    virtual void setPublicId(const XMLCh* const publicId) = 0;
228
229    /**
230     * Set the system identifier for this input source.
231     *
232     * <p>The system id is always required. The public id may be used to map
233     * to another system id, but the system id must always be present as a fall
234     * back.</p>
235     *
236     * <p>If the system ID is a URL, it must be fully resolved.</p>
237     *
238     * <p><b>"Experimental - subject to change"</b></p>
239     *
240     * @param systemId The system identifier as a string.
241     * @see #getSystemId
242     * @since DOM Level 3
243     */
244    virtual void setSystemId(const XMLCh* const systemId) = 0;
245
246    /**
247     * Set the base URI to be used for resolving relative URIs to absolute
248     * URIs. If the baseURI is itself a relative URI, the behavior is
249     * implementation dependent.
250     *
251     * <p><b>"Experimental - subject to change"</b></p>
252     *
253     * @param baseURI The base URI.
254     * @see #getBaseURI
255     * @since DOM Level 3
256     */
257    virtual void setBaseURI(const XMLCh* const baseURI) = 0;
258    //@}
259
260    // -----------------------------------------------------------------------
261    //  Non-standard Extension
262    // -----------------------------------------------------------------------
263    /** @name Non-standard Extension */
264    //@{
265
266    /**
267     * Makes the byte stream for this input source.
268     *
269     * <p>The derived class must create and return a binary input stream of an
270     * appropriate type for its kind of data source. The returned stream must
271     * be dynamically allocated and becomes the parser's property.
272     * </p>
273     *
274     * <p><b>"Experimental - subject to change"</b></p>
275     *
276     * @see BinInputStream
277     */
278    virtual BinInputStream* makeStream() const = 0;
279
280    /**
281     * Indicates if the parser should issue fatal error if this input source
282     * is not found.  If set to false, the parser issue warning message instead.
283     *
284     * <p><b>"Experimental - subject to change"</b></p>
285     *
286     * @param  flag True if the parser should issue fatal error if this input source is not found.
287     *               If set to false, the parser issue warning message instead.  (Default: true)
288     *
289     * @see #getIssueFatalErrorIfNotFound
290     */
291    virtual void setIssueFatalErrorIfNotFound(const bool flag) = 0;
292
293
294    /**
295     * Get the flag that indicates if the parser should issue fatal error if this input source
296     * is not found.
297     *
298     * <p><b>"Experimental - subject to change"</b></p>
299     *
300     * @return True if the parser should issue fatal error if this input source is not found.
301     *         False if the parser issue warning message instead.
302     * @see #setIssueFatalErrorIfNotFound
303     */
304    virtual bool getIssueFatalErrorIfNotFound() const = 0;
305
306    /**
307     * Called to indicate that this DOMInputSource is no longer in use
308     * and that the implementation may relinquish any resources associated with it.
309     *
310     * Access to a released object will lead to unexpected result.
311     */
312    virtual void              release() = 0;
313    //@}
314};
315
316
317XERCES_CPP_NAMESPACE_END
318
319#endif
Note: See TracBrowser for help on using the repository browser.