Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.8

Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

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 <map>
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 public:
00075 
00076     typedef XERCES_CPP_NAMESPACE_QUALIFIER SAXParser            SAXParserType;
00077 
00085     XercesParserLiaison(XercesDOMSupport&   theSupport);
00086 
00090     XercesParserLiaison();
00091 
00092     virtual
00093     ~XercesParserLiaison();
00094 
00095     // These interfaces are inherited from XMLParserLiaison...
00096 
00097     virtual void
00098     reset();
00099 
00100     virtual ExecutionContext*
00101     getExecutionContext() const;
00102 
00103     virtual void
00104     setExecutionContext(ExecutionContext&   theContext);
00105 
00106     virtual XalanDocument*
00107     parseXMLStream(
00108             const InputSourceType&  reader,
00109             const XalanDOMString&   identifier = XalanDOMString());
00110 
00111     virtual void
00112     parseXMLStream(
00113             const InputSourceType&  urlInputSource,
00114             DocumentHandlerType&    handler,
00115             const XalanDOMString&   identifier = XalanDOMString());
00116 
00117     virtual void
00118     destroyDocument(XalanDocument*  theDocument);
00119 
00120     virtual int
00121     getIndent() const;
00122 
00123     virtual void
00124     setIndent(int   i);
00125 
00126     virtual bool
00127     getUseValidation() const;
00128 
00129     virtual void
00130     setUseValidation(bool   b);
00131 
00132     virtual const XalanDOMString
00133     getParserDescription() const;
00134 
00135     virtual EntityResolverType*
00136     getEntityResolver() const;
00137 
00138     virtual void
00139     setEntityResolver(EntityResolverType*   resolver);
00140 
00141 
00142     // These interfaces are new to XercesParserLiaison...
00143 
00153     virtual DOMDocument_Type*
00154     createDOMFactory();
00155 
00161     virtual void
00162     destroyDocument(DOMDocument_Type*   theDocument);
00163 
00174     virtual bool
00175     getIncludeIgnorableWhitespace() const;
00176 
00195     virtual void
00196     setIncludeIgnorableWhitespace(bool  include);
00197 
00203     virtual ErrorHandlerType*
00204     getErrorHandler() const;
00205 
00214     virtual void
00215     setErrorHandler(ErrorHandlerType*   handler);
00216 
00226     virtual bool
00227     getDoNamespaces() const;
00228 
00246     virtual void
00247     setDoNamespaces(bool    newState);
00248 
00258     virtual bool
00259     getExitOnFirstFatalError() const;
00260 
00276     virtual void
00277     setExitOnFirstFatalError(bool   newState);
00278 
00285     virtual const XalanDOMChar*
00286     getExternalSchemaLocation() const;
00287 
00294     virtual void
00295     setExternalSchemaLocation(const XalanDOMChar*   location);
00296 
00303     virtual const XalanDOMChar*
00304     getExternalNoNamespaceSchemaLocation() const;
00305 
00312     virtual void
00313     setExternalNoNamespaceSchemaLocation(const XalanDOMChar*    location);
00314 
00315 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00328     XalanDocument*
00329     createDocument(const DOM_Document_Type&     theXercesDocument)
00330     {
00331         return createDocument(theXercesDocument, m_threadSafe, m_buildBridge);
00332     }
00333 
00348     XalanDocument*
00349     createDocument(
00350             const DOM_Document_Type&    theXercesDocument,
00351             bool                        threadSafe,
00352             bool                        buildBridge);
00353 #endif
00354 
00364     XalanDocument*
00365     createDocument(const DOMDocument_Type*  theXercesDocument)
00366     {
00367         return createDocument(theXercesDocument, m_threadSafe, m_buildWrapper, m_buildMaps);
00368     }
00369 
00382     XalanDocument*
00383     createDocument(
00384             const DOMDocument_Type*     theXercesDocument,
00385             bool                        threadSafe,
00386             bool                        buildWrapper,
00387             bool                        buildMaps = false);
00388 
00389 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00390 
00402     XercesDocumentBridge*
00403     mapDocument(const XalanDocument*    theDocument) const;
00404 #endif
00405 
00415     XercesDocumentWrapper*
00416     mapDocumentToWrapper(const XalanDocument*   theDocument) const;
00417 
00418 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00419 
00431     DOM_Document_Type
00432     mapXercesDocument(const XalanDocument*  theDocument) const;
00433 #endif
00434 
00444     const DOMDocument_Type*
00445     mapToXercesDocument(const XalanDocument*    theDocument) const;
00446 
00447     // Implementations for SAX ErrorHandler
00448 
00449     virtual void
00450     warning(const SAXParseExceptionType&    exception);
00451 
00452     virtual void
00453     error(const SAXParseExceptionType&  exception);
00454    
00455     virtual void
00456     fatalError(const SAXParseExceptionType&     exception);
00457 
00458     virtual void
00459     resetErrors();
00460 
00461     struct DocumentEntry
00462     {
00463 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00464         bool    m_isDeprecated;
00465 
00466         bool
00467         isDeprecated() const
00468         {
00469             return m_isDeprecated;
00470         }
00471 #else
00472         bool
00473         isDeprecated() const
00474         {
00475             return false;
00476         }
00477 #endif
00478 
00479         bool    m_isOwned;
00480 
00481         bool
00482         isOwned() const
00483         {
00484             return m_isOwned;
00485         }
00486 
00487 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00488         union
00489         {
00490             XercesDocumentBridge*   m_bridge;
00491             XercesDocumentWrapper*  m_wrapper;
00492         };
00493 
00494         DocumentEntry&
00495         operator=(XercesDocumentBridge*     theBridge)
00496         {
00497             m_isDeprecated = true;
00498 
00499             m_bridge = theBridge;
00500 
00501             m_isOwned = true;
00502 
00503             return *this;
00504         }
00505 
00506         DocumentEntry&
00507         operator=(XercesDocumentWrapper*    theWrapper)
00508         {
00509             m_isDeprecated = false;
00510 
00511             m_wrapper = theWrapper;
00512 
00513             m_isOwned = true;
00514 
00515             return *this;
00516         }
00517 #else
00518         XercesDocumentWrapper*  m_wrapper;
00519 
00520         DocumentEntry&
00521         operator=(XercesDocumentWrapper*    theWrapper)
00522         {
00523             m_wrapper = theWrapper;
00524 
00525             m_isOwned = true;
00526 
00527             return *this;
00528         }
00529 #endif
00530     };
00531 
00532 #if defined(XALAN_NO_STD_NAMESPACE)
00533     typedef map<const XalanDocument*,
00534                 DocumentEntry,
00535                 less<const XalanDocument*> >    DocumentMapType;
00536 #else
00537     typedef std::map<const XalanDocument*,
00538                      DocumentEntry>             DocumentMapType;
00539 #endif
00540 
00549     bool
00550     getBuildBridgeNodes() const
00551     
00552     {
00553         return m_buildBridge;
00554     }
00555 
00568     void
00569     setBuildBridgeNodes(bool    newState)
00570     {
00571         m_buildBridge = newState;
00572 
00573         if (newState == false)
00574         {
00575             m_threadSafe = false;
00576         }
00577     }
00578 
00584     bool
00585     getBuildWrapperNodes() const
00586     
00587     {
00588         return m_buildWrapper;
00589     }
00590 
00600     void
00601     setBuildWrapperNodes(bool   newState)
00602     {
00603         m_buildWrapper = newState;
00604 
00605         if (newState == false)
00606         {
00607             m_threadSafe = false;
00608         }
00609     }
00610 
00620     bool
00621     getThreadSafe() const
00622     
00623     {
00624         return m_threadSafe;
00625     }
00626 
00636     void
00637     setThreadSafe(bool  newState)
00638     {
00639         m_threadSafe = newState;
00640 
00641         if (m_threadSafe == true)
00642         {
00643             m_buildWrapper = true;
00644             m_buildBridge = true;
00645         }
00646     }
00647 
00655     bool
00656     getBuildMaps() const
00657     
00658     {
00659         return m_buildMaps;
00660     }
00661  
00673     void
00674     setBuildMaps(bool   newState)
00675     {
00676         m_buildMaps = newState;
00677     }
00678 
00679 #if XERCES_VERSION_MAJOR >= 2
00680     typedef XERCES_CPP_NAMESPACE_QUALIFIER XercesDOMParser  DOMParserType;
00681 #else
00682     typedef XERCES_CPP_NAMESPACE_QUALIFIER DOMParser        DOMParserType;
00683 #endif
00684 
00685 protected:
00686 
00687     static void
00688     formatErrorMessage(
00689             const SAXParseExceptionType&    e,
00690             XalanDOMString&                 theMessage);
00691 
00692     DOMParserType*
00693     CreateDOMParser();
00694 
00695     virtual SAXParserType*
00696     CreateSAXParser();
00697 
00698 #if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
00699 
00709     XercesDocumentBridge*
00710     doCreateDocument(
00711             const DOM_Document_Type&    theXercesDocument,
00712             bool                        threadSafe,
00713             bool                        buildBridge);
00714 #endif
00715 
00725     XercesDocumentWrapper*
00726     doCreateDocument(
00727             const DOMDocument_Type*     theXercesDocument,
00728             bool                        threadSafe,
00729             bool                        buildWrapper,
00730             bool                        buildMaps,
00731             bool                        isOwned);
00732 
00733 private:
00734 
00735     // Data members...
00736     int                 m_indent;
00737 
00738     bool                m_useValidation;
00739 
00740     bool                m_includeIgnorableWhitespace;
00741 
00742     bool                m_doNamespaces;
00743 
00744     bool                m_exitOnFirstFatalError;
00745 
00746     EntityResolverType* m_entityResolver;
00747 
00748     ErrorHandlerType*   m_errorHandler;
00749 
00750     XalanDOMString      m_externalSchemaLocation;
00751 
00752     XalanDOMString      m_externalNoNamespaceSchemaLocation;
00753 
00754     DocumentMapType     m_documentMap;
00755 
00756     bool                m_buildWrapper;
00757 
00758     bool                m_buildBridge;
00759 
00760     bool                m_threadSafe;
00761 
00762     bool                m_buildMaps;
00763 
00764     ExecutionContext*   m_executionContext;
00765 };
00766 
00767 
00768 
00769 XALAN_CPP_NAMESPACE_END
00770 
00771 
00772 
00773 #endif  // XercesPARSERLIAISON_HEADER_GUARD_1357924680

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.8
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.