Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XercesParserLiaison.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2004 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #if !defined(XercesPARSERLIAISON_HEADER_GUARD_1357924680)
00017 #define XercesPARSERLIAISON_HEADER_GUARD_1357924680
00018 
00019 
00020 // Base include file.  Must be first.
00021 #include <xalanc/XercesParserLiaison/XercesParserLiaisonDefinitions.hpp>
00022 
00023 
00024 
00025 // Standard Library header files.
00026 #include <xalanc/Include/XalanMap.hpp>
00027 
00028 
00029 
00030 // Xerces DOM header files
00031 #include <xercesc/sax/ErrorHandler.hpp>
00032 
00033 
00034 
00035 // Base class header file.
00036 #include <xalanc/XMLSupport/XMLParserLiaison.hpp>
00037 
00038 
00039 
00040 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00041 #include <xalanc/XercesParserLiaison/Deprecated/XercesBridgeTypes.hpp>
00042 #endif
00043 #include <xalanc/XercesParserLiaison/XercesWrapperTypes.hpp>
00044 
00045 
00046 
00047 #if XERCES_VERSION_MAJOR >= 2
00048 XALAN_DECLARE_XERCES_CLASS(XercesDOMParser)
00049 #else
00050 XALAN_DECLARE_XERCES_CLASS(DOMParser)
00051 #endif
00052 XALAN_DECLARE_XERCES_CLASS(SAXParser)
00053 
00054 
00055 
00056 XALAN_CPP_NAMESPACE_BEGIN
00057 
00058 
00059 
00060 class XercesDOMSupport;
00061 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00062 class XercesDocumentBridge;
00063 #endif
00064 class XercesDocumentWrapper;
00065 
00066 
00067 typedef XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException    SAXParseExceptionType;
00068 
00069 
00070 class XALAN_XERCESPARSERLIAISON_EXPORT XercesParserLiaison :
00071     public XMLParserLiaison,
00072     public ErrorHandlerType
00073 {
00074     
00075 public:
00076 
00077     typedef XERCES_CPP_NAMESPACE_QUALIFIER SAXParser            SAXParserType;
00078 
00086     XercesParserLiaison( XercesDOMSupport&  theSupport, MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
00087 
00091     XercesParserLiaison(MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
00092 
00093     virtual
00094     ~XercesParserLiaison();
00095 
00096 
00097 
00098     // These interfaces are inherited from XMLParserLiaison...
00099     MemoryManagerType&
00100     getMemoryManager()
00101     {
00102         return m_externalSchemaLocation.getMemoryManager();
00103     }
00104 
00105     virtual void
00106     reset();
00107 
00108     virtual ExecutionContext*
00109     getExecutionContext() const;
00110 
00111     virtual void
00112     setExecutionContext(ExecutionContext&   theContext);
00113 
00114     virtual XalanDocument*
00115     parseXMLStream(
00116             const InputSourceType&  reader,
00117             const XalanDOMString&   identifier = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
00118 
00119     virtual void
00120     parseXMLStream(
00121             const InputSourceType&  urlInputSource,
00122             DocumentHandlerType&    handler,
00123             const XalanDOMString&   identifier = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
00124 
00125     virtual void
00126     destroyDocument(XalanDocument*  theDocument);
00127 
00128     virtual int
00129     getIndent() const;
00130 
00131     virtual void
00132     setIndent(int   i);
00133 
00134     virtual bool
00135     getUseValidation() const;
00136 
00137     virtual void
00138     setUseValidation(bool   b);
00139 
00140     virtual const XalanDOMString&
00141     getParserDescription(XalanDOMString& theResult) const;
00142 
00143     virtual EntityResolverType*
00144     getEntityResolver() const;
00145 
00146     virtual void
00147     setEntityResolver(EntityResolverType*   resolver);
00148 
00149 
00150     // These interfaces are new to XercesParserLiaison...
00151 
00161     virtual DOMDocument_Type*
00162     createDOMFactory();
00163 
00169     virtual void
00170     destroyDocument(DOMDocument_Type*   theDocument);
00171 
00182     virtual bool
00183     getIncludeIgnorableWhitespace() const;
00184 
00203     virtual void
00204     setIncludeIgnorableWhitespace(bool  include);
00205 
00211     virtual ErrorHandlerType*
00212     getErrorHandler() const;
00213 
00222     virtual void
00223     setErrorHandler(ErrorHandlerType*   handler);
00224 
00234     virtual bool
00235     getDoNamespaces() const;
00236 
00254     virtual void
00255     setDoNamespaces(bool    newState);
00256 
00266     virtual bool
00267     getExitOnFirstFatalError() const;
00268 
00284     virtual void
00285     setExitOnFirstFatalError(bool   newState);
00286 
00293     virtual const XalanDOMChar*
00294     getExternalSchemaLocation() const;
00295 
00302     virtual void
00303     setExternalSchemaLocation(const XalanDOMChar*   location);
00304 
00311     virtual const XalanDOMChar*
00312     getExternalNoNamespaceSchemaLocation() const;
00313 
00320     virtual void
00321     setExternalNoNamespaceSchemaLocation(const XalanDOMChar*    location);
00322 
00323 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00324 
00336     XalanDocument*
00337     createDocument(const DOM_Document_Type&     theXercesDocument)
00338     {
00339         return createDocument(theXercesDocument, m_threadSafe, m_buildBridge);
00340     }
00341 
00356     XalanDocument*
00357     createDocument(
00358             const DOM_Document_Type&    theXercesDocument,
00359             bool                        threadSafe,
00360             bool                        buildBridge);
00361 #endif
00362 
00372     XalanDocument*
00373     createDocument(const DOMDocument_Type*  theXercesDocument)
00374     {
00375         return createDocument(theXercesDocument, m_threadSafe, m_buildWrapper, m_buildMaps);
00376     }
00377 
00390     XalanDocument*
00391     createDocument(
00392             const DOMDocument_Type*     theXercesDocument,
00393             bool                        threadSafe,
00394             bool                        buildWrapper,
00395             bool                        buildMaps = false);
00396 
00397 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00398 
00410     XercesDocumentBridge*
00411     mapDocument(const XalanDocument*    theDocument) const;
00412 #endif
00413 
00423     XercesDocumentWrapper*
00424     mapDocumentToWrapper(const XalanDocument*   theDocument) const;
00425 
00426 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00427 
00439     DOM_Document_Type
00440     mapXercesDocument(const XalanDocument*  theDocument) const;
00441 #endif
00442 
00452     const DOMDocument_Type*
00453     mapToXercesDocument(const XalanDocument*    theDocument) const;
00454 
00455     // Implementations for SAX ErrorHandler
00456 
00457     virtual void
00458     warning(const SAXParseExceptionType&    exception);
00459 
00460     virtual void
00461     error(const SAXParseExceptionType&  exception);
00462    
00463     virtual void
00464     fatalError(const SAXParseExceptionType&     exception);
00465 
00466     virtual void
00467     resetErrors();
00468 
00469     struct DocumentEntry
00470     {
00471 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00472         bool    m_isDeprecated;
00473 
00474         bool
00475         isDeprecated() const
00476         {
00477             return m_isDeprecated;
00478         }
00479 #else
00480         bool
00481         isDeprecated() const
00482         {
00483             return false;
00484         }
00485 #endif
00486 
00487         bool    m_isOwned;
00488 
00489         bool
00490         isOwned() const
00491         {
00492             return m_isOwned;
00493         }
00494 
00495 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00496         union
00497         {
00498             XercesDocumentBridge*   m_bridge;
00499             XercesDocumentWrapper*  m_wrapper;
00500         };
00501 
00502         DocumentEntry&
00503         operator=(XercesDocumentBridge*     theBridge)
00504         {
00505             m_isDeprecated = true;
00506 
00507             m_bridge = theBridge;
00508 
00509             m_isOwned = true;
00510 
00511             return *this;
00512         }
00513 
00514         DocumentEntry&
00515         operator=(XercesDocumentWrapper*    theWrapper)
00516         {
00517             m_isDeprecated = false;
00518 
00519             m_wrapper = theWrapper;
00520 
00521             m_isOwned = true;
00522 
00523             return *this;
00524         }
00525 #else
00526         XercesDocumentWrapper*  m_wrapper;
00527 
00528         DocumentEntry&
00529         operator=(XercesDocumentWrapper*    theWrapper)
00530         {
00531             m_wrapper = theWrapper;
00532 
00533             m_isOwned = true;
00534 
00535             return *this;
00536         }
00537 #endif
00538     };
00539 
00540     typedef XalanMap<const XalanDocument*, DocumentEntry>   DocumentMapType;
00541 
00550     bool
00551     getBuildBridgeNodes() const
00552     
00553     {
00554         return m_buildBridge;
00555     }
00556 
00569     void
00570     setBuildBridgeNodes(bool    newState)
00571     {
00572         m_buildBridge = newState;
00573 
00574         if (newState == false)
00575         {
00576             m_threadSafe = false;
00577         }
00578     }
00579 
00585     bool
00586     getBuildWrapperNodes() const
00587     
00588     {
00589         return m_buildWrapper;
00590     }
00591 
00601     void
00602     setBuildWrapperNodes(bool   newState)
00603     {
00604         m_buildWrapper = newState;
00605 
00606         if (newState == false)
00607         {
00608             m_threadSafe = false;
00609         }
00610     }
00611 
00621     bool
00622     getThreadSafe() const
00623     
00624     {
00625         return m_threadSafe;
00626     }
00627 
00637     void
00638     setThreadSafe(bool  newState)
00639     {
00640         m_threadSafe = newState;
00641 
00642         if (m_threadSafe == true)
00643         {
00644             m_buildWrapper = true;
00645             m_buildBridge = true;
00646         }
00647     }
00648 
00656     bool
00657     getBuildMaps() const
00658     
00659     {
00660         return m_buildMaps;
00661     }
00662  
00674     void
00675     setBuildMaps(bool   newState)
00676     {
00677         m_buildMaps = newState;
00678     }
00679 
00680 #if XERCES_VERSION_MAJOR >= 2
00681     typedef XERCES_CPP_NAMESPACE_QUALIFIER XercesDOMParser  DOMParserType;
00682 #else
00683     typedef XERCES_CPP_NAMESPACE_QUALIFIER DOMParser        DOMParserType;
00684 #endif
00685 
00686 protected:
00687 
00688     static void
00689     formatErrorMessage(
00690             const SAXParseExceptionType&    e,
00691             XalanDOMString&                 theMessage);
00692 
00693 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00694 
00704     XercesDocumentBridge*
00705     doCreateDocument(
00706             const DOM_Document_Type&    theXercesDocument,
00707             bool                        threadSafe,
00708             bool                        buildBridge);
00709 #endif
00710 
00720     XercesDocumentWrapper*
00721     doCreateDocument(
00722             const DOMDocument_Type*     theXercesDocument,
00723             bool                        threadSafe,
00724             bool                        buildWrapper,
00725             bool                        buildMaps,
00726             bool                        isOwned);
00727 
00728 private:
00729 
00730     void
00731     ensureSAXParser();
00732 
00733     void
00734     ensureDOMParser();
00735 
00736     DOMParserType*
00737     createDOMParser();
00738 
00739     SAXParserType*
00740     createSAXParser();
00741 
00742 
00743 
00744     // Data members...
00745     int                 m_indent;
00746 
00747     bool                m_useValidation;
00748 
00749     bool                m_includeIgnorableWhitespace;
00750 
00751     bool                m_doNamespaces;
00752 
00753     bool                m_exitOnFirstFatalError;
00754 
00755     EntityResolverType* m_entityResolver;
00756 
00757     ErrorHandlerType*   m_errorHandler;
00758 
00759     XalanDOMString      m_externalSchemaLocation;
00760 
00761     XalanDOMString      m_externalNoNamespaceSchemaLocation;
00762 
00763     DocumentMapType     m_documentMap;
00764 
00765     bool                m_buildWrapper;
00766 
00767     bool                m_buildBridge;
00768 
00769     bool                m_threadSafe;
00770 
00771     bool                m_buildMaps;
00772 
00773     ExecutionContext*   m_executionContext;
00774 
00775     SAXParserType*      m_saxParser;
00776 
00777     DOMParserType*      m_domParser;
00778 };
00779 
00780 
00781 
00782 XALAN_CPP_NAMESPACE_END
00783 
00784 
00785 
00786 #endif  // XercesPARSERLIAISON_HEADER_GUARD_1357924680

Interpreting class diagrams

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

dot

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

Apache Logo