## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.7

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  * The Apache Software License, Version 1.1
    00003  *
    00004  *
    00005  * Copyright (c) 1999-2004 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 <xalanc/XercesParserLiaison/XercesParserLiaisonDefinitions.hpp>
    00063
    00064
    00065
    00066 // Standard Library header files.
    00067 #include <map>
    00068
    00069
    00070
    00071 // Xerces DOM header files
    00072 #include <xercesc/sax/ErrorHandler.hpp>
    00073
    00074
    00075
    00076 // Base class header file.
    00077 #include <xalanc/XMLSupport/XMLParserLiaison.hpp>
    00078
    00079
    00080
    00081 #include <xalanc/XercesParserLiaison/Deprecated/XercesBridgeTypes.hpp>
    00082 #include <xalanc/XercesParserLiaison/XercesWrapperTypes.hpp>
    00083
    00084
    00085
    00086 #if XERCES_VERSION_MAJOR >= 2
    00087 XALAN_DECLARE_XERCES_CLASS(XercesDOMParser)
    00088 #else
    00089 XALAN_DECLARE_XERCES_CLASS(DOMParser)
    00090 #endif
    00091 XALAN_DECLARE_XERCES_CLASS(SAXParser)
    00092
    00093
    00094
    00095 XALAN_CPP_NAMESPACE_BEGIN
    00096
    00097
    00098
    00099 class DOMSupport;
    00100 class XercesDOMSupport;
    00101 class XercesDocumentBridge;
    00102 class XercesDocumentWrapper;
    00103 class XSLProcessor;
    00104
    00105 typedef XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException    SAXParseExceptionType;
    00106
    00107
    00108 class XALAN_XERCESPARSERLIAISON_EXPORT XercesParserLiaison :
    00109     public XMLParserLiaison,
    00110     public ErrorHandlerType
    00111 {
    00112 public:
    00113
    00114     typedef XERCES_CPP_NAMESPACE_QUALIFIER SAXParser            SAXParserType;
    00115
    00123     XercesParserLiaison(XercesDOMSupport&   theSupport);
    00124
    00128     XercesParserLiaison();
    00129
    00130     virtual
    00131     ~XercesParserLiaison();
    00132
    00133     // These interfaces are inherited from XMLParserLiaison...
    00134
    00135     virtual void
    00136     reset();
    00137
    00138     virtual ExecutionContext*
    00139     getExecutionContext() const;
    00140
    00141     virtual void
    00142     setExecutionContext(ExecutionContext&   theContext);
    00143
    00144     virtual XalanDocument*
    00145     parseXMLStream(
    00146             const InputSourceType&  reader,
    00147             const XalanDOMString&   identifier = XalanDOMString());
    00148
    00149     virtual void
    00150     parseXMLStream(
    00151             const InputSourceType&  urlInputSource,
    00152             DocumentHandlerType&    handler,
    00153             const XalanDOMString&   identifier = XalanDOMString());
    00154
    00155     // Create a non-thread safe document, with no synchronization and no bridge...
    00156     virtual XalanDocument*
    00157     createDocument();
    00158
    00159     // Create a non-thread safe document, with no synchronization and no bridge...
    00160     virtual XalanDocument*
    00161     createDOMFactory();
    00162
    00163     virtual void
    00164     destroyDocument(XalanDocument*  theDocument);
    00165
    00166     virtual int
    00167     getIndent() const;
    00168
    00169     virtual void
    00170     setIndent(int   i);
    00171
    00172     virtual bool
    00173     getUseValidation() const;
    00174
    00175     virtual void
    00176     setUseValidation(bool   b);
    00177
    00178     virtual const XalanDOMString
    00179     getParserDescription() const;
    00180
    00181     virtual EntityResolverType*
    00182     getEntityResolver() const;
    00183
    00184     virtual void
    00185     setEntityResolver(EntityResolverType*   resolver);
    00186
    00187
    00188     // These interfaces are new to XercesParserLiaison...
    00189
    00200     virtual bool
    00201     getIncludeIgnorableWhitespace() const;
    00202
    00221     virtual void
    00222     setIncludeIgnorableWhitespace(bool  include);
    00223
    00229     virtual ErrorHandlerType*
    00230     getErrorHandler() const;
    00231
    00240     virtual void
    00241     setErrorHandler(ErrorHandlerType*   handler);
    00242
    00252     virtual bool
    00253     getDoNamespaces() const;
    00254
    00272     virtual void
    00273     setDoNamespaces(bool    newState);
    00274
    00284     virtual bool
    00285     getExitOnFirstFatalError() const;
    00286
    00302     virtual void
    00303     setExitOnFirstFatalError(bool   newState);
    00304
    00311     virtual const XalanDOMChar*
    00312     getExternalSchemaLocation() const;
    00313
    00320     virtual void
    00321     setExternalSchemaLocation(const XalanDOMChar*   location);
    00322
    00329     virtual const XalanDOMChar*
    00330     getExternalNoNamespaceSchemaLocation() const;
    00331
    00338     virtual void
    00339     setExternalNoNamespaceSchemaLocation(const XalanDOMChar*    location);
    00340
    00353     XalanDocument*
    00354     createDocument(const DOM_Document_Type&     theXercesDocument)
    00355     {
    00356         return createDocument(theXercesDocument, m_threadSafe, m_buildBridge);
    00357     }
    00358
    00373     XalanDocument*
    00374     createDocument(
    00375             const DOM_Document_Type&    theXercesDocument,
    00376             bool                        threadSafe,
    00377             bool                        buildBridge);
    00378
    00388     XalanDocument*
    00389     createDocument(const DOMDocument_Type*  theXercesDocument)
    00390     {
    00391         return createDocument(theXercesDocument, m_threadSafe, m_buildWrapper, m_buildMaps);
    00392     }
    00393
    00406     XalanDocument*
    00407     createDocument(
    00408             const DOMDocument_Type*     theXercesDocument,
    00409             bool                        threadSafe,
    00410             bool                        buildWrapper,
    00411             bool                        buildMaps = false);
    00412
    00425     XercesDocumentBridge*
    00426     mapDocument(const XalanDocument*    theDocument) const;
    00427
    00437     XercesDocumentWrapper*
    00438     mapDocumentToWrapper(const XalanDocument*   theDocument) const;
    00439
    00452     DOM_Document_Type
    00453     mapXercesDocument(const XalanDocument*  theDocument) const;
    00454
    00464     const DOMDocument_Type*
    00465     mapToXercesDocument(const XalanDocument*    theDocument) const;
    00466
    00467     // Implementations for SAX ErrorHandler
    00468
    00469     virtual void
    00470     warning(const SAXParseExceptionType&    exception);
    00471
    00472     virtual void
    00473     error(const SAXParseExceptionType&  exception);
    00474
    00475     virtual void
    00476     fatalError(const SAXParseExceptionType&     exception);
    00477
    00478     virtual void
    00479     resetErrors();
    00480
    00481     struct DocumentEntry
    00482     {
    00483         bool    m_isDeprecated;
    00484         bool    m_isOwned;
    00485
    00486         union
    00487         {
    00488             XercesDocumentBridge*   m_bridge;
    00489             XercesDocumentWrapper*  m_wrapper;
    00490         };
    00491
    00492         DocumentEntry&
    00493         operator=(XercesDocumentBridge*     theBridge)
    00494         {
    00495             m_isDeprecated = true;
    00496
    00497             m_bridge = theBridge;
    00498
    00499             m_isOwned = true;
    00500
    00501             return *this;
    00502         }
    00503
    00504         DocumentEntry&
    00505         operator=(XercesDocumentWrapper*    theWrapper)
    00506         {
    00507             m_isDeprecated = false;
    00508
    00509             m_wrapper = theWrapper;
    00510
    00511             m_isOwned = true;
    00512
    00513             return *this;
    00514         }
    00515     };
    00516
    00517 #if defined(XALAN_NO_STD_NAMESPACE)
    00518     typedef map<const XalanDocument*,
    00519                 DocumentEntry,
    00520                 less<const XalanDocument*> >    DocumentMapType;
    00521 #else
    00522     typedef std::map<const XalanDocument*,
    00523                      DocumentEntry>             DocumentMapType;
    00524 #endif
    00525
    00534     bool
    00535     getBuildBridgeNodes() const
    00536
    00537     {
    00538         return m_buildBridge;
    00539     }
    00540
    00553     void
    00554     setBuildBridgeNodes(bool    newState)
    00555     {
    00556         m_buildBridge = newState;
    00557
    00558         if (newState == false)
    00559         {
    00560             m_threadSafe = false;
    00561         }
    00562     }
    00563
    00569     bool
    00570     getBuildWrapperNodes() const
    00571
    00572     {
    00573         return m_buildWrapper;
    00574     }
    00575
    00585     void
    00586     setBuildWrapperNodes(bool   newState)
    00587     {
    00588         m_buildWrapper = newState;
    00589
    00590         if (newState == false)
    00591         {
    00592             m_threadSafe = false;
    00593         }
    00594     }
    00595
    00605     bool
    00606     getThreadSafe() const
    00607
    00608     {
    00609         return m_threadSafe;
    00610     }
    00611
    00621     void
    00622     setThreadSafe(bool  newState)
    00623     {
    00624         m_threadSafe = newState;
    00625
    00626         if (m_threadSafe == true)
    00627         {
    00628             m_buildWrapper = true;
    00629             m_buildBridge = true;
    00630         }
    00631     }
    00632
    00640     bool
    00641     getBuildMaps() const
    00642
    00643     {
    00644         return m_buildMaps;
    00645     }
    00646
    00658     void
    00659     setBuildMaps(bool   newState)
    00660     {
    00661         m_buildMaps = newState;
    00662     }
    00663
    00664 #if XERCES_VERSION_MAJOR >= 2
    00665     typedef XERCES_CPP_NAMESPACE_QUALIFIER XercesDOMParser  DOMParserType;
    00666 #else
    00667     typedef XERCES_CPP_NAMESPACE_QUALIFIER DOMParser        DOMParserType;
    00668 #endif
    00669
    00670 protected:
    00671
    00672     static void
    00673     formatErrorMessage(
    00674             const SAXParseExceptionType&    e,
    00675             XalanDOMString&                 theMessage);
    00676
    00677     DOMParserType*
    00678     CreateDOMParser();
    00679
    00680     virtual SAXParserType*
    00681     CreateSAXParser();
    00682
    00693     XercesDocumentBridge*
    00694     doCreateDocument(
    00695             const DOM_Document_Type&    theXercesDocument,
    00696             bool                        threadSafe,
    00697             bool                        buildBridge);
    00698
    00708     XercesDocumentWrapper*
    00709     doCreateDocument(
    00710             const DOMDocument_Type*     theXercesDocument,
    00711             bool                        threadSafe,
    00712             bool                        buildWrapper,
    00713             bool                        buildMaps,
    00714             bool                        isOwned);
    00715
    00716 private:
    00717
    00718     // Data members...
    00719     int                 m_indent;
    00720
    00721     bool                m_useValidation;
    00722
    00723     bool                m_includeIgnorableWhitespace;
    00724
    00725     bool                m_doNamespaces;
    00726
    00727     bool                m_exitOnFirstFatalError;
    00728
    00729     EntityResolverType* m_entityResolver;
    00730
    00731     ErrorHandlerType*   m_errorHandler;
    00732
    00733     XalanDOMString      m_externalSchemaLocation;
    00734
    00735     XalanDOMString      m_externalNoNamespaceSchemaLocation;
    00736
    00737     DocumentMapType     m_documentMap;
    00738
    00739     bool                m_buildWrapper;
    00740
    00741     bool                m_buildBridge;
    00742
    00743     bool                m_threadSafe;
    00744
    00745     bool                m_buildMaps;
    00746
    00747     ExecutionContext*   m_executionContext;
    00748 };
    00749
    00750
    00751
    00752 XALAN_CPP_NAMESPACE_END
    00753
    00754
    00755
    00756 #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.7 Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.