Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


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 
36 XALAN_DECLARE_XERCES_CLASS(ContentHandler)
37 XALAN_DECLARE_XERCES_CLASS(DTDHandler)
38 XALAN_DECLARE_XERCES_CLASS(LexicalHandler)
39 XALAN_DECLARE_XERCES_CLASS(SAX2XMLReaderImpl)
40 
41 
42 
43 XALAN_CPP_NAMESPACE_BEGIN
44 
45 
46 
49 
50 
51 
52 /*
53 typedef XERCES_CPP_NAMESPACE_QUALIFIER ContentHandler ContentHandlerType;
54 typedef XERCES_CPP_NAMESPACE_QUALIFIER DTDHandler DTDHandlerType;
55 typedef XERCES_CPP_NAMESPACE_QUALIFIER LexicalHandler LexicalHandlerType;
56 typedef XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader SAX2XMLReaderType;
57 */
58 
59 XALAN_USING_XERCES(ContentHandler)
60 XALAN_USING_XERCES(DTDHandler)
61 XALAN_USING_XERCES(LexicalHandler)
62 XALAN_USING_XERCES(SAX2XMLReaderImpl)
63 
64 
66 {
67 
68 public:
69 
70  /**
71  * Construct a XalanSourceTreeParserLiaison instance.
72  *
73  * @param theSupport instance of DOMSupport object
74  *
75  * @deprecated This constructor is deprecated. Use the next constructor instead.
76  */
78  XalanSourceTreeDOMSupport& theSupport,
79  MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
80 
81  /**
82  * Construct a XalanSourceTreeParserLiaison instance.
83  */
84  XalanSourceTreeParserLiaison(MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
85 
86  MemoryManager&
88  {
89  return m_documentMap.getMemoryManager();
90  }
91 
92  virtual
94 
95  /**
96  * Get the value of the flag which determines if the data of all
97  * text nodes are pooled, or just whitespace text nodes.
98  *
99  * @return true if the data of all text nodes are pooled, false otherwise.
100  */
101  bool
103  {
104  return m_poolAllText;
105  }
106 
107  /**
108  * Set the value of the flag which determines if the data of all
109  * text nodes are pooled, or just whitespace text nodes.
110  *
111  * @param fValue The new value for the flag.
112  */
113  void
114  setPoolAllText(bool fValue)
115  {
116  m_poolAllText = fValue;
117  }
118 
119  // These interfaces are inherited from XMLParserLiaison...
120 
121  virtual void
122  reset();
123 
124  virtual ExecutionContext*
125  getExecutionContext() const;
126 
127  virtual void
128  setExecutionContext(ExecutionContext& theContext);
129 
130  virtual XalanDocument*
131  parseXMLStream(
132  const InputSource& reader,
134 
135  virtual void
136  parseXMLStream(
137  const InputSource& inputSource,
138  DocumentHandler& handler,
140 
141  virtual void
142  destroyDocument(XalanDocument* theDocument);
143 
144  virtual int
145  getIndent() const;
146 
147  virtual void
148  setIndent(int i);
149 
150  virtual bool
151  getUseValidation() const;
152 
153  virtual void
154  setUseValidation(bool b);
155 
156  virtual const XalanDOMString&
157  getParserDescription(XalanDOMString& theResult) const;
158 
159  virtual EntityResolver*
160  getEntityResolver() const;
161 
162  virtual void
163  setEntityResolver(EntityResolver* resolver);
164 
165  virtual XMLEntityResolver*
166  getXMLEntityResolver() const;
167 
168  virtual void
169  setXMLEntityResolver(XMLEntityResolver* resolver);
170 
171  virtual ErrorHandler*
172  getErrorHandler() const;
173 
174  virtual void
175  setErrorHandler(ErrorHandler* handler);
176 
177 
178  // These interfaces are new to XalanSourceTreeParserLiaison...
179 
180  /**
181  * Parse using a SAX2 ContentHandler, DTDHandler, and LexicalHandler.
182  *
183  * @param theInputSource The input source for the parser
184  * @param theContentHandler The ContentHandler to use
185  * @param theDTDHandler The DTDHandler to use. May be null.
186  * @param theLexicalHandler The LexicalHandler to use. May be null.
187  * @param identifier Used for error reporting only.
188  */
189  virtual void
190  parseXMLStream(
191  const InputSource& theInputSource,
192  ContentHandler& theContentHandler,
193  const XalanDOMString& theIdentifier,
194  DTDHandler* theDTDHandler = 0,
195  LexicalHandler* theLexicalHandler = 0);
196 
197  virtual DOMDocument_Type*
198  createDOMFactory();
199 
200  virtual void
201  destroyDocument(DOMDocument_Type* theDocument);
202 
203  /** Get the 'include ignorable whitespace' flag.
204  *
205  * This method returns the state of the parser's include ignorable
206  * whitespace flag.
207  *
208  * @return 'true' if the include ignorable whitespace flag is set on
209  * the parser, 'false' otherwise.
210  *
211  * @see #setIncludeIgnorableWhitespace
212  */
213  virtual bool
214  getIncludeIgnorableWhitespace() const;
215 
216  /** Set the 'include ignorable whitespace' flag
217  *
218  * This method allows the user to specify whether a validating parser
219  * should include ignorable whitespaces as text nodes. It has no effect
220  * on non-validating parsers which always include non-markup text.
221  * <p>When set to true (also the default), ignorable whitespaces will be
222  * added to the DOM tree as text nodes. The method
223  * DOM_Text::isWhitespace() will return true for those text
224  * nodes only.
225  * <p>When set to false, all ignorable whitespace will be discarded and
226  * no text node is added to the DOM tree. Note: applications intended
227  * to process the "xml:space" attribute should not set this flag to false.
228  *
229  * @param include The new state of the include ignorable whitespace
230  * flag.
231  *
232  * @see #getIncludeIgnorableWhitespace
233  */
234  virtual void
235  setIncludeIgnorableWhitespace(bool include);
236 
237  /**
238  * This method returns the state of the parser's namespace
239  * handling capability.
240  *
241  * @return true, if the parser is currently configured to
242  * understand namespaces, false otherwise.
243  *
244  * @see #setDoNamespaces
245  */
246  virtual bool
247  getDoNamespaces() const;
248 
249  /**
250  * This method allows users to enable or disable the parser's
251  * namespace processing. When set to true, parser starts enforcing
252  * all the constraints / rules specified by the NameSpace
253  * specification.
254  *
255  * <p>The parser's default state is: false.</p>
256  *
257  * <p>This flag is ignored by the underlying scanner if the installed
258  * validator indicates that namespace constraints should be
259  * enforced.</p>
260  *
261  * @param newState The value specifying whether NameSpace rules should
262  * be enforced or not.
263  *
264  * @see #getDoNamespaces
265  */
266  virtual void
267  setDoNamespaces(bool newState);
268 
269  /**
270  * This method returns the state of the parser's
271  * exit-on-First-Fatal-Error flag.
272  *
273  * @return true, if the parser is currently configured to
274  * exit on the first fatal error, false otherwise.
275  *
276  * @see #setExitOnFirstFatalError
277  */
278  virtual bool
279  getExitOnFirstFatalError() const;
280 
281  /**
282  * This method allows users to set the parser's behaviour when it
283  * encounters the first fatal error. If set to true, the parser
284  * will exit at the first fatal error. If false, then it will
285  * report the error and continue processing.
286  *
287  * <p>The default value is 'true' and the parser exits on the
288  * first fatal error.</p>
289  *
290  * @param newState The value specifying whether the parser should
291  * continue or exit when it encounters the first
292  * fatal error.
293  *
294  * @see #getExitOnFirstFatalError
295  */
296  virtual void
297  setExitOnFirstFatalError(bool newState);
298 
299  /**
300  * This method returns the location for an external schema document
301  * for parsing.
302  *
303  * @return A string representing the location of the external schema document
304  */
305  virtual const XalanDOMChar*
306  getExternalSchemaLocation() const;
307 
308  /**
309  * This method sets the location for an external schema document
310  * for parsing.
311  *
312  * @param location A string representing the location of the external schema document
313  */
314  virtual void
315  setExternalSchemaLocation(const XalanDOMChar* location);
316 
317  /**
318  * This method returns the location for an external schema document
319  * for parsing.
320  *
321  * @return A string representing the location of the external schema document
322  */
323  virtual const XalanDOMChar*
324  getExternalNoNamespaceSchemaLocation() const;
325 
326  /**
327  * This method sets the location for an external schema document
328  * for parsing.
329  *
330  * @param location A string representing the location of the external schema document
331  */
332  virtual void
333  setExternalNoNamespaceSchemaLocation(const XalanDOMChar* location);
334 
335  /**
336  * Map a pointer to a XalanDocument instance to its implementation
337  * class pointer. Normally, you should have no reason for doing
338  * this. The liaison will return a null pointer if it did not
339  * create the instance passed.
340  *
341  * @param theDocument A pointer to a XalanDocument instance.
342  * @return A pointer to the XalanSourceTreeDocument instance.
343  */
345  mapDocument(const XalanDocument* theDocument) const;
346 
347  /**
348  * Create a XalanSourceTreeDocument instance.
349  *
350  * @return A pointer to the XalanSourceTreeDocument instance.
351  */
353  createXalanSourceTreeDocument();
354 
355  typedef XalanMap<const XalanDocument*,
357 
358 
359 protected:
360 
361  virtual SAX2XMLReaderImpl*
362  createReader();
363 
364 private:
365 
366  void
367  ensureReader();
368 
369 
370  // Not implemented...
372 
374  operator=(const XalanSourceTreeParserLiaison&);
375 
376 
377  // Data members...
378  XercesParserLiaison m_xercesParserLiaison;
379 
380  DocumentMapType m_documentMap;
381 
382  bool m_poolAllText;
383 
384  SAX2XMLReaderImpl* m_xmlReader;
385 };
386 
387 
388 
389 XALAN_CPP_NAMESPACE_END
390 
391 
392 
393 #endif // XALANSOURCETREEPARSERLIAISON_HEADER_GUARD_1357924680
MemoryManager & getMemoryManager()
Get a reference to the current MemoryManager instance.
XalanMap< const XalanDocument *, XalanSourceTreeDocument * > DocumentMapType
void setPoolAllText(bool fValue)
Set the value of the flag which determines if the data of all text nodes are pooled, or just whitespace text nodes.
bool getPoolAllText() const
Get the value of the flag which determines if the data of all text nodes are pooled, or just whitespace text nodes.
#define XALAN_DEFAULT_MEMMGR
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument DOMDocument_Type
static MemoryManager & getDummyMemMgr()
#define XALAN_XALANSOURCETREE_EXPORT
Xalan implementation of a hashtable.
Definition: XalanMap.hpp:186
XALAN_CPP_NAMESPACE_BEGIN XALAN_USING_XERCES(Locator)

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.11
Copyright © 1999-2012 The Apache Software Foundation.
All Rights Reserved.

Apache Logo