00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999-2001 The Apache Software Foundation. All rights 00006 * reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * 1. Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in 00017 * the documentation and/or other materials provided with the 00018 * distribution. 00019 * 00020 * 3. The end-user documentation included with the redistribution, 00021 * if any, must include the following acknowledgment: 00022 * "This product includes software developed by the 00023 * Apache Software Foundation (http://www.apache.org/)." 00024 * Alternately, this acknowledgment may appear in the software itself, 00025 * if and wherever such third-party acknowledgments normally appear. 00026 * 00027 * 4. The names "Xalan" and "Apache Software Foundation" must 00028 * not be used to endorse or promote products derived from this 00029 * software without prior written permission. For written 00030 * permission, please contact apache@apache.org. 00031 * 00032 * 5. Products derived from this software may not be called "Apache", 00033 * nor may "Apache" appear in their name, without prior written 00034 * permission of the Apache Software Foundation. 00035 * 00036 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00037 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00038 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00039 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00040 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00041 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00042 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00043 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00044 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00045 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00046 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00047 * SUCH DAMAGE. 00048 * ==================================================================== 00049 * 00050 * This software consists of voluntary contributions made by many 00051 * individuals on behalf of the Apache Software Foundation and was 00052 * originally based on software copyright (c) 1999, International 00053 * Business Machines, Inc., http://www.ibm.com. For more 00054 * information on the Apache Software Foundation, please see 00055 * <http://www.apache.org/>. 00056 */ 00057 #if !defined(XercesPARSERLIAISON_HEADER_GUARD_1357924680) 00058 #define XercesPARSERLIAISON_HEADER_GUARD_1357924680 00059 00060 00061 // Base include file. Must be first. 00062 #include <XercesParserLiaison/XercesParserLiaisonDefinitions.hpp> 00063 00064 00065 00066 // Standard Library header files. 00067 #include <map> 00068 00069 00070 00071 // Xerces DOM header files 00072 #include <util/XercesDefs.hpp> 00073 #include <sax/ErrorHandler.hpp> 00074 #include <dom/DOM_Document.hpp> 00075 00076 00077 00078 // Base class header file. 00079 #include <XMLSupport/XMLParserLiaison.hpp> 00080 00081 00082 00083 class DOMParser; 00084 class DOMSupport; 00085 class EntityResolver; 00086 class InputSource; 00087 class SAXParser; 00088 class XercesDOMSupport; 00089 class XercesDocumentBridge; 00090 class XSLProcessor; 00091 00092 00093 00094 class XALAN_XERCESPARSERLIAISON_EXPORT XercesParserLiaison : public XMLParserLiaison, public ErrorHandler 00095 { 00096 public: 00097 00106 XercesParserLiaison( 00107 XercesDOMSupport& theSupport, 00108 DocumentNumberType theStartingNumber = 0); 00109 00115 XercesParserLiaison(DocumentNumberType theStartingNumber = 0); 00116 00117 virtual 00118 ~XercesParserLiaison(); 00119 00120 // These interfaces are inherited from XMLParserLiaison... 00121 00122 virtual void 00123 reset(); 00124 00125 virtual ExecutionContext* 00126 getExecutionContext() const; 00127 00128 virtual void 00129 setExecutionContext(ExecutionContext& theContext); 00130 00131 virtual XalanDocument* 00132 parseXMLStream( 00133 const InputSource& reader, 00134 const XalanDOMString& identifier = XalanDOMString()); 00135 00136 virtual void 00137 parseXMLStream( 00138 const InputSource& urlInputSource, 00139 DocumentHandler& handler, 00140 const XalanDOMString& identifier = XalanDOMString()); 00141 00142 // Create a non-thread safe document, with no synchronization and no bridge... 00143 virtual XalanDocument* 00144 createDocument(); 00145 00146 // Create a non-thread safe document, with no synchronization and no bridge... 00147 virtual XalanDocument* 00148 createDOMFactory(); 00149 00150 virtual void 00151 destroyDocument(XalanDocument* theDocument); 00152 00153 virtual DocumentNumberType 00154 getNextDocumentNumber(); 00155 00156 virtual int 00157 getIndent() const; 00158 00159 virtual void 00160 setIndent(int i); 00161 00162 virtual bool 00163 getUseValidation() const; 00164 00165 virtual void 00166 setUseValidation(bool b); 00167 00168 virtual const XalanDOMString 00169 getParserDescription() const; 00170 00171 virtual EntityResolver* 00172 getEntityResolver() const; 00173 00174 virtual void 00175 setEntityResolver(EntityResolver* resolver); 00176 00177 00178 // These interfaces are new to XercesParserLiaison... 00179 00190 virtual bool 00191 getIncludeIgnorableWhitespace() const; 00192 00211 virtual void 00212 setIncludeIgnorableWhitespace(bool include); 00213 00219 virtual ErrorHandler* 00220 getErrorHandler() const; 00221 00230 virtual void 00231 setErrorHandler(ErrorHandler* handler); 00232 00242 virtual bool 00243 getDoNamespaces() const; 00244 00262 virtual void 00263 setDoNamespaces(bool newState); 00264 00274 virtual bool 00275 getExitOnFirstFatalError() const; 00276 00292 virtual void 00293 setExitOnFirstFatalError(bool newState); 00294 00306 virtual XalanDocument* 00307 createDocument( 00308 const DOM_Document& theXercesDocument, 00309 bool threadSafe = false, 00310 bool buildBridge = false); 00311 00321 XercesDocumentBridge* 00322 mapDocument(const XalanDocument* theDocument) const; 00323 00333 DOM_Document 00334 mapXercesDocument(const XalanDocument* theDocument) const; 00335 00336 // Implementations for SAX ErrorHandler 00337 00338 virtual void 00339 warning(const SAXParseException& exception); 00340 00341 virtual void 00342 error(const SAXParseException& exception); 00343 00344 virtual void 00345 fatalError(const SAXParseException& exception); 00346 00347 virtual void 00348 resetErrors(); 00349 00350 #if defined(XALAN_NO_NAMESPACES) 00351 typedef map<const XalanDocument*, 00352 XercesDocumentBridge*, 00353 less<const XalanDocument*> > DocumentMapType; 00354 #else 00355 typedef std::map<const XalanDocument*, 00356 XercesDocumentBridge*> DocumentMapType; 00357 #endif 00358 00364 bool 00365 getBuildBridgeNodes() const 00366 00367 { 00368 return m_buildBridge; 00369 } 00370 00380 void 00381 setBuildBridgeNodes(bool newState) 00382 { 00383 m_buildBridge = newState; 00384 00385 if (newState == false) 00386 { 00387 m_threadSafe = false; 00388 } 00389 } 00390 00400 bool 00401 getThreadSafe() const 00402 00403 { 00404 return m_threadSafe; 00405 } 00406 00416 void 00417 setThreadSafe(bool newState) 00418 { 00419 m_threadSafe = newState; 00420 00421 if (m_threadSafe == true) 00422 { 00423 m_buildBridge = true; 00424 } 00425 } 00426 00427 DocumentNumberType 00428 getDocumentNumber() const 00429 { 00430 return m_documentNumber; 00431 } 00432 00433 protected: 00434 00435 static void 00436 formatErrorMessage( 00437 const SAXParseException& e, 00438 XalanDOMString& theMessage); 00439 00440 virtual DOMParser* 00441 CreateDOMParser(); 00442 00443 virtual SAXParser* 00444 CreateSAXParser(); 00445 00454 virtual XercesDocumentBridge* 00455 doCreateDocument( 00456 const DOM_Document& theXercesDocument, 00457 bool threadSafe, 00458 bool buildBridge); 00459 00460 private: 00461 00462 // Data members... 00463 unsigned long m_documentNumber; 00464 00465 int m_indent; 00466 00467 bool m_useValidation; 00468 00469 bool m_includeIgnorableWhitespace; 00470 00471 bool m_doNamespaces; 00472 00473 bool m_exitOnFirstFatalError; 00474 00475 EntityResolver* m_entityResolver; 00476 00477 ErrorHandler* m_errorHandler; 00478 00479 DocumentMapType m_documentMap; 00480 00481 bool m_buildBridge; 00482 00483 bool m_threadSafe; 00484 00485 ExecutionContext* m_executionContext; 00486 }; 00487 00488 00489 00490 #endif // XercesPARSERLIAISON_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.3 |
|