source: icXML/icXML-devel/src/xercesc/framework/Wrapper4DOMLSInput.hpp @ 2722

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

Original Xerces files with import mods for icxercesc

File size: 7.3 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: Wrapper4DOMLSInput.hpp 527149 2007-04-10 14:56:39Z amassari $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_WRAPPER4DOMLSINPUT_HPP)
23#define XERCESC_INCLUDE_GUARD_WRAPPER4DOMLSINPUT_HPP
24
25#include <xercesc/sax/InputSource.hpp>
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29class DOMLSInput;
30class DOMLSResourceResolver;
31
32/**
33  * Wrap a DOMLSInput object and make it behave like a SAX InputSource.
34  */
35class XMLPARSER_EXPORT Wrapper4DOMLSInput: public InputSource
36{
37public:
38    /** @name Constructors and Destructor */
39    //@{
40
41  /**
42    * Constructor
43    *
44    * Wrap a DOMLSInput and make it behave like a SAX InputSource.
45    * By default, the wrapper will adopt the DOMLSInput that is wrapped.
46    *
47    * @param  inputSource  The DOMLSInput to be wrapped
48    * @param  entityResolver  The DOMLSResourceResolver to be used when resolving publicID entries
49    * @param  adoptFlag    Indicates if the wrapper should adopt the wrapped
50    *                      DOMLSInput. Default is true.
51    * @param  manager      Pointer to the memory manager to be used to
52    *                      allocate objects.
53    */
54    Wrapper4DOMLSInput
55    (
56        DOMLSInput* const inputSource
57        , DOMLSResourceResolver* entityResolver = 0
58        , const bool adoptFlag = true
59        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
60    );
61
62  /**
63    * Destructor
64    *
65    */
66    virtual ~Wrapper4DOMLSInput();
67    //@}
68
69
70    // -----------------------------------------------------------------------
71    /** @name Virtual input source interface */
72    //@{
73  /**
74    *
75    * Makes the byte stream for this input source.
76    *
77    * <p>The function will call the makeStream of the wrapped input source.
78    * The returned stream becomes the parser's property.</p>
79    *
80    * @see BinInputStream
81    */
82    BinInputStream* makeStream() const;
83
84    //@}
85
86    // -----------------------------------------------------------------------
87    /** @name Getter methods */
88    //@{
89  /**
90    *
91    * An input source can be set to force the parser to assume a particular
92    * encoding for the data that input source reprsents, via the setEncoding()
93    * method. This method will delegate to the wrapped input source to return
94    * name of the encoding that is to be forced. If the encoding has never
95    * been forced, it returns a null pointer.
96    *
97    * @return The forced encoding, or null if none was supplied.
98    * @see #setEncoding
99    */
100    const XMLCh* getEncoding() const;
101
102
103  /**
104    *
105    * Get the public identifier for this input source. Delegated to the
106    * wrapped input source object.
107    *
108    * @return The public identifier, or null if none was supplied.
109    * @see #setPublicId
110    */
111    const XMLCh* getPublicId() const;
112
113
114  /**
115    *
116    * Get the system identifier for this input source. Delegated to the
117    * wrapped input source object.
118    *
119    * <p>If the system ID is a URL, it will be fully resolved.</p>
120    *
121    * @return The system identifier.
122    * @see #setSystemId
123    */
124    const XMLCh* getSystemId() const;
125
126  /**
127    *
128    * Get the flag that indicates if the parser should issue fatal error if
129    * this input source is not found. Delegated to the wrapped input source
130    * object.
131    *
132    * @return True  if the parser should issue fatal error if this input source
133    *               is not found.
134    *         False if the parser issue warning message instead.
135    * @see #setIssueFatalErrorIfNotFound
136    */
137    bool getIssueFatalErrorIfNotFound() const;
138
139    //@}
140
141
142    // -----------------------------------------------------------------------
143    /** @name Setter methods */
144    //@{
145
146  /**
147    *
148    * Set the encoding which will be required for use with the XML text read
149    * via a stream opened by this input source. This will update the wrapped
150    * input source object.
151    *
152    * <p>This is usually not set, allowing the encoding to be sensed in the
153    * usual XML way. However, in some cases, the encoding in the file is known
154    * to be incorrect because of intermediate transcoding, for instance
155    * encapsulation within a MIME document.
156    *
157    * @param encodingStr The name of the encoding to force.
158    */
159    void setEncoding(const XMLCh* const encodingStr);
160
161
162  /**
163    *
164    * Set the public identifier for this input source. This will update the
165    * wrapped input source object.
166    *
167    * <p>The public identifier is always optional: if the application writer
168    * includes one, it will be provided as part of the location information.</p>
169    *
170    * @param publicId The public identifier as a string.
171    * @see Locator#getPublicId
172    * @see SAXParseException#getPublicId
173    * @see #getPublicId
174    */
175    void setPublicId(const XMLCh* const publicId);
176
177  /**
178    *
179    * Set the system identifier for this input source. This will update the
180    * wrapped input source object.
181    *
182    * <p>The system id is always required. The public id may be used to map
183    * to another system id, but the system id must always be present as a fall
184    * back.</p>
185    *
186    * <p>If the system ID is a URL, it must be fully resolved.</p>
187    *
188    * @param systemId The system identifier as a string.
189    * @see #getSystemId
190    * @see Locator#getSystemId
191    * @see SAXParseException#getSystemId
192    */
193    void setSystemId(const XMLCh* const systemId);
194
195  /**
196    *
197    * Indicates if the parser should issue fatal error if this input source
198    * is not found.  If set to false, the parser issue warning message instead.
199    * This will update the wrapped input source object.
200    *
201    * @param  flag True if the parser should issue fatal error if this input source is not found.
202    *               If set to false, the parser issue warning message instead.  (Default: true)
203    *
204    * @see #getIssueFatalErrorIfNotFound
205    */
206    void setIssueFatalErrorIfNotFound(const bool flag);
207
208    //@}
209
210
211private:
212    // -----------------------------------------------------------------------
213    //  Unimplemented constructors and operators
214    // -----------------------------------------------------------------------
215    Wrapper4DOMLSInput(const Wrapper4DOMLSInput&);
216    Wrapper4DOMLSInput& operator=(const Wrapper4DOMLSInput&);
217
218    // -----------------------------------------------------------------------
219    //  Private data members
220    // -----------------------------------------------------------------------
221    bool                    fAdoptInputSource,
222                            fForceXMLChEncoding;
223    DOMLSInput*             fInputSource;
224    DOMLSResourceResolver*  fEntityResolver;
225};
226
227XERCES_CPP_NAMESPACE_END
228
229
230#endif
Note: See TracBrowser for help on using the repository browser.