source: icXML/icXML-devel/src/xercesc/dom/DOMLSInput.hpp @ 6297

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

Original Xerces files with import mods for icxercesc

File size: 9.4 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: DOMLSInput.hpp 527149 2007-04-10 14:56:39Z amassari $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_DOMLSINPUT_HPP)
23#define XERCESC_INCLUDE_GUARD_DOMLSINPUT_HPP
24
25#include <xercesc/util/XercesDefs.hpp>
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29
30class InputSource;
31
32
33/**
34  * This interface represents a single input source for an XML entity.
35  *
36  * <p>This interface allows an application to encapsulate information about
37  * an input source in a single object, which may include a public identifier,
38  * a system identifier, a byte stream (possibly with a specified encoding),
39  * and/or a character stream.</p>
40  *
41  * <p>There are two places that the application will deliver this input source
42  * to the parser: as the argument to the parse method, or as the return value
43  * of the DOMLSResourceResolver.resolveResource method.</p>
44  *
45  * <p>The DOMLSParser will use the DOMLSInput object to determine how to
46  * read XML input. If there is a character stream available, the parser will
47  * read that stream directly; if not, the parser will use a byte stream, if
48  * available; if neither a character stream nor a byte stream is available,
49  * the parser will attempt to open a URI connection to the resource identified
50  * by the system identifier.</p>
51  *
52  * <p>A DOMLSInput object belongs to the application: the parser shall
53  * never modify it in any way (it may modify a copy if necessary).</p>
54  *
55  * @see DOMLSParser#parse
56  * @see DOMLSResourceResolver#resolveResource
57  * @since DOM Level 3
58  */
59class CDOM_EXPORT DOMLSInput
60{
61protected:
62    // -----------------------------------------------------------------------
63    //  Hidden constructors
64    // -----------------------------------------------------------------------
65    /** @name Hidden constructors */
66    //@{   
67    DOMLSInput() {};
68    //@}
69
70private:
71    // -----------------------------------------------------------------------
72    // Unimplemented constructors and operators
73    // -----------------------------------------------------------------------
74    /** @name Unimplemented constructors and operators */
75    //@{
76    DOMLSInput(const DOMLSInput &);
77    DOMLSInput & operator = (const DOMLSInput &);
78    //@}
79
80public:
81    // -----------------------------------------------------------------------
82    //  All constructors are hidden, just the destructor is available
83    // -----------------------------------------------------------------------
84    /** @name Destructor */
85    //@{
86    /**
87     * Destructor
88     *
89     */
90    virtual ~DOMLSInput() {};
91    //@}
92
93    // -----------------------------------------------------------------------
94    //  Virtual DOMLSInput interface
95    // -----------------------------------------------------------------------
96    /** @name Functions introduced in DOM Level 3 */
97    //@{
98    // -----------------------------------------------------------------------
99    //  Getter methods
100    // -----------------------------------------------------------------------
101    /**
102     * String data to parse. If provided, this will always be treated as a sequence of 16-bit units (UTF-16 encoded characters).
103     * It is not a requirement to have an XML declaration when using stringData. If an XML declaration is present, the value of
104     * the encoding attribute will be ignored.
105     *
106     */
107    virtual const XMLCh* getStringData() const = 0;
108
109    /**
110     * Returns the byte stream for this input source.
111     *
112     * @see InputSource
113     */
114    virtual InputSource* getByteStream() const = 0;
115
116    /**
117     * An input source can be set to force the parser to assume a particular
118     * encoding for the data that input source reprsents, via the setEncoding()
119     * method. This method returns name of the encoding that is to be forced.
120     * If the encoding has never been forced, it returns a null pointer.
121     *
122     * @return The forced encoding, or null if none was supplied.
123     * @see #setEncoding
124     * @since DOM Level 3
125     */
126    virtual const XMLCh* getEncoding() const = 0;
127
128
129    /**
130     * Get the public identifier for this input source.
131     *
132     * @return The public identifier, or null if none was supplied.
133     * @see #setPublicId
134     * @since DOM Level 3
135     */
136    virtual const XMLCh* getPublicId() const = 0;
137
138
139    /**
140     * Get the system identifier for this input source.
141     *
142     * <p>If the system ID is a URL, it will be fully resolved.</p>
143     *
144     * @return The system identifier.
145     * @see #setSystemId
146     * @since DOM Level 3
147     */
148    virtual const XMLCh* getSystemId() const = 0;
149
150
151    /**
152     * Get the base URI to be used for resolving relative URIs to absolute
153     * URIs. If the baseURI is itself a relative URI, the behavior is
154     * implementation dependent.
155     *
156     * @return The base URI.
157     * @see #setBaseURI
158     * @since DOM Level 3
159     */
160    virtual const XMLCh* getBaseURI() const = 0;
161
162    // -----------------------------------------------------------------------
163    //  Setter methods
164    // -----------------------------------------------------------------------
165    // -----------------------------------------------------------------------
166    /**
167     * Sets the UTF-16 string for this input source.
168     *
169     */
170    virtual void setStringData(const XMLCh* data) = 0;
171
172    /**
173     * Sets the byte stream for this input source.
174     *
175     * @see BinInputStream
176     */
177    virtual void setByteStream(InputSource* stream) = 0;
178
179    /**
180     * Set the encoding which will be required for use with the XML text read
181     * via a stream opened by this input source.
182     *
183     * <p>This is usually not set, allowing the encoding to be sensed in the
184     * usual XML way. However, in some cases, the encoding in the file is known
185     * to be incorrect because of intermediate transcoding, for instance
186     * encapsulation within a MIME document.
187     *
188     * @param encodingStr The name of the encoding to force.
189     * @since DOM Level 3
190     */
191    virtual void setEncoding(const XMLCh* const encodingStr) = 0;
192
193
194    /**
195     * Set the public identifier for this input source.
196     *
197     * <p>The public identifier is always optional: if the application writer
198     * includes one, it will be provided as part of the location information.</p>
199     *
200     * @param publicId The public identifier as a string.
201     * @see #getPublicId
202     * @since DOM Level 3
203     */
204    virtual void setPublicId(const XMLCh* const publicId) = 0;
205
206    /**
207     * Set the system identifier for this input source.
208     *
209     * <p>The system id is always required. The public id may be used to map
210     * to another system id, but the system id must always be present as a fall
211     * back.</p>
212     *
213     * <p>If the system ID is a URL, it must be fully resolved.</p>
214     *
215     * @param systemId The system identifier as a string.
216     * @see #getSystemId
217     * @since DOM Level 3
218     */
219    virtual void setSystemId(const XMLCh* const systemId) = 0;
220
221    /**
222     * Set the base URI to be used for resolving relative URIs to absolute
223     * URIs. If the baseURI is itself a relative URI, the behavior is
224     * implementation dependent.
225     *
226     * @param baseURI The base URI.
227     * @see #getBaseURI
228     * @since DOM Level 3
229     */
230    virtual void setBaseURI(const XMLCh* const baseURI) = 0;
231    //@}
232
233    // -----------------------------------------------------------------------
234    //  Non-standard Extension
235    // -----------------------------------------------------------------------
236    /** @name Non-standard Extension */
237    //@{
238
239    /**
240     * Indicates if the parser should issue fatal error if this input source
241     * is not found.  If set to false, the parser issue warning message instead.
242     *
243     * @param  flag True if the parser should issue fatal error if this input source is not found.
244     *               If set to false, the parser issue warning message instead.  (Default: true)
245     *
246     * @see #getIssueFatalErrorIfNotFound
247     */
248    virtual void setIssueFatalErrorIfNotFound(bool flag) = 0;
249
250
251    /**
252     * Get the flag that indicates if the parser should issue fatal error if this input source
253     * is not found.
254     *
255     * @return True if the parser should issue fatal error if this input source is not found.
256     *         False if the parser issue warning message instead.
257     * @see #setIssueFatalErrorIfNotFound
258     */
259    virtual bool getIssueFatalErrorIfNotFound() const = 0;
260
261    /**
262     * Called to indicate that this DOMLSInput is no longer in use
263     * and that the implementation may relinquish any resources associated with it.
264     *
265     * Access to a released object will lead to unexpected result.
266     */
267    virtual void release() = 0;
268    //@}
269};
270
271
272XERCES_CPP_NAMESPACE_END
273
274#endif
Note: See TracBrowser for help on using the repository browser.