Xalan-C++ API Reference 1.12.0
XalanSourceTreeParserLiaison.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(XALANSOURCETREEPARSERLIAISON_HEADER_GUARD_1357924680)
19#define XALANSOURCETREEPARSERLIAISON_HEADER_GUARD_1357924680
20
21
22// Base include file. Must be first.
24
25
26
28
29
30
33
34
35
36namespace XERCES_CPP_NAMESPACE
37{
38 class ContentHandler;
39 class DTDHandler;
40 class LexicalHandler;
41 class SAX2XMLReaderImpl;
42}
43
44
45
46namespace XALAN_CPP_NAMESPACE {
47
48
49
50class XalanSourceTreeDOMSupport;
51class XalanSourceTreeDocument;
52
53
54
55/*
56typedef xercesc::ContentHandler ContentHandlerType;
57typedef xercesc::DTDHandler DTDHandlerType;
58typedef xercesc::LexicalHandler LexicalHandlerType;
59typedef xercesc::SAX2XMLReader SAX2XMLReaderType;
60*/
61
62using xercesc::ContentHandler;
63using xercesc::DTDHandler;
64using xercesc::LexicalHandler;
65using xercesc::SAX2XMLReaderImpl;
66
67
69{
70
71public:
72
73 /**
74 * Construct a XalanSourceTreeParserLiaison instance.
75 *
76 * @param theSupport instance of DOMSupport object
77 *
78 * @deprecated This constructor is deprecated. Use the next constructor instead.
79 */
82 MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
83
84 /**
85 * Construct a XalanSourceTreeParserLiaison instance.
86 */
88
89 MemoryManager&
91 {
92 return m_documentMap.getMemoryManager();
93 }
94
95 virtual
97
98 /**
99 * Get the value of the flag which determines if the data of all
100 * text nodes are pooled, or just whitespace text nodes.
101 *
102 * @return true if the data of all text nodes are pooled, false otherwise.
103 */
104 bool
106 {
107 return m_poolAllText;
108 }
109
110 /**
111 * Set the value of the flag which determines if the data of all
112 * text nodes are pooled, or just whitespace text nodes.
113 *
114 * @param fValue The new value for the flag.
115 */
116 void
118 {
119 m_poolAllText = fValue;
120 }
121
122 // These interfaces are inherited from XMLParserLiaison...
123
124 virtual void
126
127 virtual ExecutionContext*
129
130 virtual void
132
133 virtual XalanDocument*
135 const InputSource& reader,
136 const XalanDOMString& identifier = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
137
138 virtual void
140 const InputSource& inputSource,
141 DocumentHandler& handler,
142 const XalanDOMString& identifier = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
143
144 virtual void
146
147 virtual int
148 getIndent() const;
149
150 virtual void
152
153 virtual bool
155
156 virtual void
158
159 virtual const XalanDOMString&
161
162 virtual EntityResolver*
164
165 virtual void
166 setEntityResolver(EntityResolver* resolver);
167
168 virtual XMLEntityResolver*
170
171 virtual void
172 setXMLEntityResolver(XMLEntityResolver* resolver);
173
174 virtual ErrorHandler*
176
177 virtual void
178 setErrorHandler(ErrorHandler* handler);
179
180
181 // These interfaces are new to XalanSourceTreeParserLiaison...
182
183 /**
184 * Parse using a SAX2 ContentHandler, DTDHandler, and LexicalHandler.
185 *
186 * @param theInputSource The input source for the parser
187 * @param theContentHandler The ContentHandler to use
188 * @param theDTDHandler The DTDHandler to use. May be null.
189 * @param theLexicalHandler The LexicalHandler to use. May be null.
190 * @param identifier Used for error reporting only.
191 */
192 virtual void
194 const InputSource& theInputSource,
195 ContentHandler& theContentHandler,
197 DTDHandler* theDTDHandler = 0,
198 LexicalHandler* theLexicalHandler = 0);
199
200 virtual DOMDocument_Type*
202
203 virtual void
205
206 /** Get the 'include ignorable whitespace' flag.
207 *
208 * This method returns the state of the parser's include ignorable
209 * whitespace flag.
210 *
211 * @return 'true' if the include ignorable whitespace flag is set on
212 * the parser, 'false' otherwise.
213 *
214 * @see #setIncludeIgnorableWhitespace
215 */
216 virtual bool
218
219 /** Set the 'include ignorable whitespace' flag
220 *
221 * This method allows the user to specify whether a validating parser
222 * should include ignorable whitespaces as text nodes. It has no effect
223 * on non-validating parsers which always include non-markup text.
224 * <p>When set to true (also the default), ignorable whitespaces will be
225 * added to the DOM tree as text nodes. The method
226 * DOM_Text::isWhitespace() will return true for those text
227 * nodes only.
228 * <p>When set to false, all ignorable whitespace will be discarded and
229 * no text node is added to the DOM tree. Note: applications intended
230 * to process the "xml:space" attribute should not set this flag to false.
231 *
232 * @param include The new state of the include ignorable whitespace
233 * flag.
234 *
235 * @see #getIncludeIgnorableWhitespace
236 */
237 virtual void
239
240 /**
241 * This method returns the state of the parser's namespace
242 * handling capability.
243 *
244 * @return true, if the parser is currently configured to
245 * understand namespaces, false otherwise.
246 *
247 * @see #setDoNamespaces
248 */
249 virtual bool
251
252 /**
253 * This method allows users to enable or disable the parser's
254 * namespace processing. When set to true, parser starts enforcing
255 * all the constraints / rules specified by the NameSpace
256 * specification.
257 *
258 * <p>The parser's default state is: false.</p>
259 *
260 * <p>This flag is ignored by the underlying scanner if the installed
261 * validator indicates that namespace constraints should be
262 * enforced.</p>
263 *
264 * @param newState The value specifying whether NameSpace rules should
265 * be enforced or not.
266 *
267 * @see #getDoNamespaces
268 */
269 virtual void
271
272 /**
273 * This method returns the state of the parser's
274 * exit-on-First-Fatal-Error flag.
275 *
276 * @return true, if the parser is currently configured to
277 * exit on the first fatal error, false otherwise.
278 *
279 * @see #setExitOnFirstFatalError
280 */
281 virtual bool
283
284 /**
285 * This method allows users to set the parser's behaviour when it
286 * encounters the first fatal error. If set to true, the parser
287 * will exit at the first fatal error. If false, then it will
288 * report the error and continue processing.
289 *
290 * <p>The default value is 'true' and the parser exits on the
291 * first fatal error.</p>
292 *
293 * @param newState The value specifying whether the parser should
294 * continue or exit when it encounters the first
295 * fatal error.
296 *
297 * @see #getExitOnFirstFatalError
298 */
299 virtual void
301
302 /**
303 * This method returns the location for an external schema document
304 * for parsing.
305 *
306 * @return A string representing the location of the external schema document
307 */
308 virtual const XalanDOMChar*
310
311 /**
312 * This method sets the location for an external schema document
313 * for parsing.
314 *
315 * @param location A string representing the location of the external schema document
316 */
317 virtual void
319
320 /**
321 * This method returns the location for an external schema document
322 * for parsing.
323 *
324 * @return A string representing the location of the external schema document
325 */
326 virtual const XalanDOMChar*
328
329 /**
330 * This method sets the location for an external schema document
331 * for parsing.
332 *
333 * @param location A string representing the location of the external schema document
334 */
335 virtual void
337
338 /**
339 * Map a pointer to a XalanDocument instance to its implementation
340 * class pointer. Normally, you should have no reason for doing
341 * this. The liaison will return a null pointer if it did not
342 * create the instance passed.
343 *
344 * @param theDocument A pointer to a XalanDocument instance.
345 * @return A pointer to the XalanSourceTreeDocument instance.
346 */
349
350 /**
351 * Create a XalanSourceTreeDocument instance.
352 *
353 * @return A pointer to the XalanSourceTreeDocument instance.
354 */
357
358 typedef XalanMap<const XalanDocument*,
360
361
362protected:
363
364 virtual SAX2XMLReaderImpl*
366
367private:
368
369 void
370 ensureReader();
371
372
373 // Not implemented...
375
377 operator=(const XalanSourceTreeParserLiaison&);
378
379
380 // Data members...
381 XercesParserLiaison m_xercesParserLiaison;
382
383 DocumentMapType m_documentMap;
384
385 bool m_poolAllText;
386
387 SAX2XMLReaderImpl* m_xmlReader;
388};
389
390
391
392}
393
394
395
396#endif // XALANSOURCETREEPARSERLIAISON_HEADER_GUARD_1357924680
#define XALAN_DEFAULT_MEMMGR
#define XALAN_XALANSOURCETREE_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Xalan implementation of a hashtable.
Definition XalanMap.hpp:187
void setPoolAllText(bool fValue)
Set the value of the flag which determines if the data of all text nodes are pooled,...
virtual bool getIncludeIgnorableWhitespace() const
Get the 'include ignorable whitespace' flag.
bool getPoolAllText() const
Get the value of the flag which determines if the data of all text nodes are pooled,...
virtual void setExecutionContext(ExecutionContext &theContext)
Set the current ExecutionContext instance.
virtual void parseXMLStream(const InputSource &theInputSource, ContentHandler &theContentHandler, const XalanDOMString &theIdentifier, DTDHandler *theDTDHandler=0, LexicalHandler *theLexicalHandler=0)
Parse using a SAX2 ContentHandler, DTDHandler, and LexicalHandler.
MemoryManager & getMemoryManager()
Get a reference to the current MemoryManager instance.
virtual void setExternalNoNamespaceSchemaLocation(const XalanDOMChar *location)
This method sets the location for an external schema document for parsing.
virtual void setEntityResolver(EntityResolver *resolver)
This method installs the user-specified EntityResolver on the parser.
virtual void reset()
Reset the instance, freeing any XalanDocument instances created through parseXMLStream().
virtual bool getUseValidation() const
Get whether or not validation will be performed.
virtual const XalanDOMChar * getExternalNoNamespaceSchemaLocation() const
This method returns the location for an external schema document for parsing.
XalanMap< const XalanDocument *, XalanSourceTreeDocument * > DocumentMapType
virtual void setExternalSchemaLocation(const XalanDOMChar *location)
This method sets the location for an external schema document for parsing.
virtual void setXMLEntityResolver(XMLEntityResolver *resolver)
This method installs the user-specified XMLEntityResolver on the parser.
virtual DOMDocument_Type * createDOMFactory()
virtual ExecutionContext * getExecutionContext() const
Get a pointer to the current ExecutionContext instance, which may be null.
virtual void setIndent(int i)
Set the amount to indent when indent-result="yes".
XalanSourceTreeParserLiaison(XalanSourceTreeDOMSupport &theSupport, MemoryManager &theManager XALAN_DEFAULT_MEMMGR)
Construct a XalanSourceTreeParserLiaison instance.
virtual int getIndent() const
Get the amount to indent when indent-result="yes".
virtual void destroyDocument(XalanDocument *theDocument)
Destroy the supplied XalanDocument instance.
XalanSourceTreeDocument * createXalanSourceTreeDocument()
Create a XalanSourceTreeDocument instance.
virtual void setDoNamespaces(bool newState)
This method allows users to enable or disable the parser's namespace processing.
XalanSourceTreeDocument * mapDocument(const XalanDocument *theDocument) const
Map a pointer to a XalanDocument instance to its implementation class pointer.
XalanSourceTreeParserLiaison(MemoryManager &theManager XALAN_DEFAULT_MEMMGR)
Construct a XalanSourceTreeParserLiaison instance.
virtual XMLEntityResolver * getXMLEntityResolver() const
This method returns the installed XMLEntityResolver.
virtual void destroyDocument(DOMDocument_Type *theDocument)
virtual bool getExitOnFirstFatalError() const
This method returns the state of the parser's exit-on-First-Fatal-Error flag.
virtual ErrorHandler * getErrorHandler() const
This method returns the installed error handler.
virtual void setIncludeIgnorableWhitespace(bool include)
Set the 'include ignorable whitespace' flag.
virtual void setErrorHandler(ErrorHandler *handler)
This method installs the user-specified error handler.
virtual void parseXMLStream(const InputSource &inputSource, DocumentHandler &handler, const XalanDOMString &identifier=XalanDOMString(XalanMemMgrs::getDummyMemMgr()))
Parse the text pointed at by the reader as XML.
virtual SAX2XMLReaderImpl * createReader()
virtual const XalanDOMChar * getExternalSchemaLocation() const
This method returns the location for an external schema document for parsing.
virtual void setExitOnFirstFatalError(bool newState)
This method allows users to set the parser's behaviour when it encounters the first fatal error.
virtual EntityResolver * getEntityResolver() const
This method returns the installed EntityResolver.
virtual XalanDocument * parseXMLStream(const InputSource &reader, const XalanDOMString &identifier=XalanDOMString(XalanMemMgrs::getDummyMemMgr()))
Parse the text pointed at by the reader as XML, and return a DOM Document interface.
virtual void setUseValidation(bool b)
If set to true, validation will be performed.
virtual const XalanDOMString & getParserDescription(XalanDOMString &theResult) const
Return a string suitable for telling the user what parser is being used.
virtual bool getDoNamespaces() const
This method returns the state of the parser's namespace handling capability.
xercesc::DOMDocument DOMDocument_Type