00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(XALANSOURCETREEPARSERLIAISON_HEADER_GUARD_1357924680) 00019 #define XALANSOURCETREEPARSERLIAISON_HEADER_GUARD_1357924680 00020 00021 00022 // Base include file. Must be first. 00023 #include <xalanc/XalanSourceTree/XalanSourceTreeDefinitions.hpp> 00024 00025 00026 00027 #include <xalanc/Include/XalanMap.hpp> 00028 00029 00030 00031 #include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp> 00032 #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp> 00033 00034 00035 00036 XALAN_DECLARE_XERCES_CLASS(ContentHandler) 00037 XALAN_DECLARE_XERCES_CLASS(DTDHandler) 00038 XALAN_DECLARE_XERCES_CLASS(LexicalHandler) 00039 XALAN_DECLARE_XERCES_CLASS(SAX2XMLReaderImpl) 00040 00041 00042 00043 XALAN_CPP_NAMESPACE_BEGIN 00044 00045 00046 00047 class XalanSourceTreeDOMSupport; 00048 class XalanSourceTreeDocument; 00049 00050 00051 00052 /* 00053 typedef XERCES_CPP_NAMESPACE_QUALIFIER ContentHandler ContentHandlerType; 00054 typedef XERCES_CPP_NAMESPACE_QUALIFIER DTDHandler DTDHandlerType; 00055 typedef XERCES_CPP_NAMESPACE_QUALIFIER LexicalHandler LexicalHandlerType; 00056 typedef XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader SAX2XMLReaderType; 00057 */ 00058 00059 XALAN_USING_XERCES(ContentHandler) 00060 XALAN_USING_XERCES(DTDHandler) 00061 XALAN_USING_XERCES(LexicalHandler) 00062 XALAN_USING_XERCES(SAX2XMLReaderImpl) 00063 00064 00065 class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeParserLiaison : public XMLParserLiaison 00066 { 00067 00068 public: 00069 00070 /** 00071 * Construct a XalanSourceTreeParserLiaison instance. 00072 * 00073 * @param theSupport instance of DOMSupport object 00074 * 00075 * @deprecated This constructor is deprecated. Use the next constructor instead. 00076 */ 00077 XalanSourceTreeParserLiaison( 00078 XalanSourceTreeDOMSupport& theSupport, 00079 MemoryManager& theManager XALAN_DEFAULT_MEMMGR); 00080 00081 /** 00082 * Construct a XalanSourceTreeParserLiaison instance. 00083 */ 00084 XalanSourceTreeParserLiaison(MemoryManager& theManager XALAN_DEFAULT_MEMMGR); 00085 00086 MemoryManager& 00087 getMemoryManager() 00088 { 00089 return m_documentMap.getMemoryManager(); 00090 } 00091 00092 virtual 00093 ~XalanSourceTreeParserLiaison(); 00094 00095 /** 00096 * Get the value of the flag which determines if the data of all 00097 * text nodes are pooled, or just whitespace text nodes. 00098 * 00099 * @return true if the data of all text nodes are pooled, false otherwise. 00100 */ 00101 bool 00102 getPoolAllText() const 00103 { 00104 return m_poolAllText; 00105 } 00106 00107 /** 00108 * Set the value of the flag which determines if the data of all 00109 * text nodes are pooled, or just whitespace text nodes. 00110 * 00111 * @param fValue The new value for the flag. 00112 */ 00113 void 00114 setPoolAllText(bool fValue) 00115 { 00116 m_poolAllText = fValue; 00117 } 00118 00119 // These interfaces are inherited from XMLParserLiaison... 00120 00121 virtual void 00122 reset(); 00123 00124 virtual ExecutionContext* 00125 getExecutionContext() const; 00126 00127 virtual void 00128 setExecutionContext(ExecutionContext& theContext); 00129 00130 virtual XalanDocument* 00131 parseXMLStream( 00132 const InputSource& reader, 00133 const XalanDOMString& identifier = XalanDOMString(XalanMemMgrs::getDummyMemMgr())); 00134 00135 virtual void 00136 parseXMLStream( 00137 const InputSource& inputSource, 00138 DocumentHandler& handler, 00139 const XalanDOMString& identifier = XalanDOMString(XalanMemMgrs::getDummyMemMgr())); 00140 00141 virtual void 00142 destroyDocument(XalanDocument* theDocument); 00143 00144 virtual int 00145 getIndent() const; 00146 00147 virtual void 00148 setIndent(int i); 00149 00150 virtual bool 00151 getUseValidation() const; 00152 00153 virtual void 00154 setUseValidation(bool b); 00155 00156 virtual const XalanDOMString& 00157 getParserDescription(XalanDOMString& theResult) const; 00158 00159 virtual EntityResolver* 00160 getEntityResolver() const; 00161 00162 virtual void 00163 setEntityResolver(EntityResolver* resolver); 00164 00165 virtual XMLEntityResolver* 00166 getXMLEntityResolver() const; 00167 00168 virtual void 00169 setXMLEntityResolver(XMLEntityResolver* resolver); 00170 00171 virtual ErrorHandler* 00172 getErrorHandler() const; 00173 00174 virtual void 00175 setErrorHandler(ErrorHandler* handler); 00176 00177 00178 // These interfaces are new to XalanSourceTreeParserLiaison... 00179 00180 /** 00181 * Parse using a SAX2 ContentHandler, DTDHandler, and LexicalHandler. 00182 * 00183 * @param theInputSource The input source for the parser 00184 * @param theContentHandler The ContentHandler to use 00185 * @param theDTDHandler The DTDHandler to use. May be null. 00186 * @param theLexicalHandler The LexicalHandler to use. May be null. 00187 * @param identifier Used for error reporting only. 00188 */ 00189 virtual void 00190 parseXMLStream( 00191 const InputSource& theInputSource, 00192 ContentHandler& theContentHandler, 00193 const XalanDOMString& theIdentifier, 00194 DTDHandler* theDTDHandler = 0, 00195 LexicalHandler* theLexicalHandler = 0); 00196 00197 virtual DOMDocument_Type* 00198 createDOMFactory(); 00199 00200 virtual void 00201 destroyDocument(DOMDocument_Type* theDocument); 00202 00203 /** Get the 'include ignorable whitespace' flag. 00204 * 00205 * This method returns the state of the parser's include ignorable 00206 * whitespace flag. 00207 * 00208 * @return 'true' if the include ignorable whitespace flag is set on 00209 * the parser, 'false' otherwise. 00210 * 00211 * @see #setIncludeIgnorableWhitespace 00212 */ 00213 virtual bool 00214 getIncludeIgnorableWhitespace() const; 00215 00216 /** Set the 'include ignorable whitespace' flag 00217 * 00218 * This method allows the user to specify whether a validating parser 00219 * should include ignorable whitespaces as text nodes. It has no effect 00220 * on non-validating parsers which always include non-markup text. 00221 * <p>When set to true (also the default), ignorable whitespaces will be 00222 * added to the DOM tree as text nodes. The method 00223 * DOM_Text::isWhitespace() will return true for those text 00224 * nodes only. 00225 * <p>When set to false, all ignorable whitespace will be discarded and 00226 * no text node is added to the DOM tree. Note: applications intended 00227 * to process the "xml:space" attribute should not set this flag to false. 00228 * 00229 * @param include The new state of the include ignorable whitespace 00230 * flag. 00231 * 00232 * @see #getIncludeIgnorableWhitespace 00233 */ 00234 virtual void 00235 setIncludeIgnorableWhitespace(bool include); 00236 00237 /** 00238 * This method returns the state of the parser's namespace 00239 * handling capability. 00240 * 00241 * @return true, if the parser is currently configured to 00242 * understand namespaces, false otherwise. 00243 * 00244 * @see #setDoNamespaces 00245 */ 00246 virtual bool 00247 getDoNamespaces() const; 00248 00249 /** 00250 * This method allows users to enable or disable the parser's 00251 * namespace processing. When set to true, parser starts enforcing 00252 * all the constraints / rules specified by the NameSpace 00253 * specification. 00254 * 00255 * <p>The parser's default state is: false.</p> 00256 * 00257 * <p>This flag is ignored by the underlying scanner if the installed 00258 * validator indicates that namespace constraints should be 00259 * enforced.</p> 00260 * 00261 * @param newState The value specifying whether NameSpace rules should 00262 * be enforced or not. 00263 * 00264 * @see #getDoNamespaces 00265 */ 00266 virtual void 00267 setDoNamespaces(bool newState); 00268 00269 /** 00270 * This method returns the state of the parser's 00271 * exit-on-First-Fatal-Error flag. 00272 * 00273 * @return true, if the parser is currently configured to 00274 * exit on the first fatal error, false otherwise. 00275 * 00276 * @see #setExitOnFirstFatalError 00277 */ 00278 virtual bool 00279 getExitOnFirstFatalError() const; 00280 00281 /** 00282 * This method allows users to set the parser's behaviour when it 00283 * encounters the first fatal error. If set to true, the parser 00284 * will exit at the first fatal error. If false, then it will 00285 * report the error and continue processing. 00286 * 00287 * <p>The default value is 'true' and the parser exits on the 00288 * first fatal error.</p> 00289 * 00290 * @param newState The value specifying whether the parser should 00291 * continue or exit when it encounters the first 00292 * fatal error. 00293 * 00294 * @see #getExitOnFirstFatalError 00295 */ 00296 virtual void 00297 setExitOnFirstFatalError(bool newState); 00298 00299 /** 00300 * This method returns the location for an external schema document 00301 * for parsing. 00302 * 00303 * @return A string representing the location of the external schema document 00304 */ 00305 virtual const XalanDOMChar* 00306 getExternalSchemaLocation() const; 00307 00308 /** 00309 * This method sets the location for an external schema document 00310 * for parsing. 00311 * 00312 * @param location A string representing the location of the external schema document 00313 */ 00314 virtual void 00315 setExternalSchemaLocation(const XalanDOMChar* location); 00316 00317 /** 00318 * This method returns the location for an external schema document 00319 * for parsing. 00320 * 00321 * @return A string representing the location of the external schema document 00322 */ 00323 virtual const XalanDOMChar* 00324 getExternalNoNamespaceSchemaLocation() const; 00325 00326 /** 00327 * This method sets the location for an external schema document 00328 * for parsing. 00329 * 00330 * @param location A string representing the location of the external schema document 00331 */ 00332 virtual void 00333 setExternalNoNamespaceSchemaLocation(const XalanDOMChar* location); 00334 00335 /** 00336 * Map a pointer to a XalanDocument instance to its implementation 00337 * class pointer. Normally, you should have no reason for doing 00338 * this. The liaison will return a null pointer if it did not 00339 * create the instance passed. 00340 * 00341 * @param theDocument A pointer to a XalanDocument instance. 00342 * @return A pointer to the XalanSourceTreeDocument instance. 00343 */ 00344 XalanSourceTreeDocument* 00345 mapDocument(const XalanDocument* theDocument) const; 00346 00347 /** 00348 * Create a XalanSourceTreeDocument instance. 00349 * 00350 * @return A pointer to the XalanSourceTreeDocument instance. 00351 */ 00352 XalanSourceTreeDocument* 00353 createXalanSourceTreeDocument(); 00354 00355 typedef XalanMap<const XalanDocument*, 00356 XalanSourceTreeDocument*> DocumentMapType; 00357 00358 00359 protected: 00360 00361 virtual SAX2XMLReaderImpl* 00362 createReader(); 00363 00364 private: 00365 00366 void 00367 ensureReader(); 00368 00369 00370 // Not implemented... 00371 XalanSourceTreeParserLiaison(const XalanSourceTreeParserLiaison&); 00372 00373 XalanSourceTreeParserLiaison& 00374 operator=(const XalanSourceTreeParserLiaison&); 00375 00376 00377 // Data members... 00378 XercesParserLiaison m_xercesParserLiaison; 00379 00380 DocumentMapType m_documentMap; 00381 00382 bool m_poolAllText; 00383 00384 SAX2XMLReaderImpl* m_xmlReader; 00385 }; 00386 00387 00388 00389 XALAN_CPP_NAMESPACE_END 00390 00391 00392 00393 #endif // XALANSOURCETREEPARSERLIAISON_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|