Xalan-C++ API Documentation

The Xalan C++ XSL Transformer Version 1.1

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 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 
00103     XercesParserLiaison(XercesDOMSupport&   theSupport);
00104 
00105     virtual
00106     ~XercesParserLiaison();
00107 
00108     // These interfaces are inherited from XMLParserLiaison...
00109 
00110     virtual void
00111     reset();
00112 
00113     virtual ExecutionContext*
00114     getExecutionContext() const;
00115 
00116     virtual void
00117     setExecutionContext(ExecutionContext&   theContext);
00118 
00119     virtual bool
00120     supportsSAX() const;
00121 
00122     virtual XalanDocument*
00123     parseXMLStream(
00124             const InputSource&      reader,
00125             const XalanDOMString&   identifier = XalanDOMString());
00126 
00127     virtual void
00128     parseXMLStream(
00129             const InputSource&      urlInputSource,
00130             DocumentHandler&        handler,
00131             const XalanDOMString&   identifier = XalanDOMString());
00132 
00133     // Create a non-thread safe document, with no synchronization and no bridge...
00134     virtual XalanDocument*
00135     createDocument();
00136 
00137     // Create a non-thread safe document, with no synchronization and no bridge...
00138     virtual XalanDocument*
00139     createDOMFactory();
00140 
00141     virtual void
00142     destroyDocument(XalanDocument*  theDocument);
00143 
00144     virtual void
00145     setSpecialCharacters(const XalanDOMString&  str);
00146 
00147     virtual const XalanDOMString&
00148     getSpecialCharacters() const;
00149 
00150     virtual int
00151     getIndent() const;
00152 
00153     virtual void
00154     setIndent(int   i);
00155 
00156     virtual bool
00157     getShouldExpandEntityRefs() const;
00158 
00159     virtual void
00160     SetShouldExpandEntityRefs(bool  b);
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 
00172     // These interfaces are new to XercesParserLiaison...
00173 
00184     virtual bool
00185     getIncludeIgnorableWhitespace() const;
00186 
00205     virtual void
00206     setIncludeIgnorableWhitespace(bool  include);
00207 
00214     virtual ErrorHandler*
00215     getErrorHandler();
00216 
00223     virtual const ErrorHandler*
00224     getErrorHandler() const;
00225 
00236     virtual void
00237     setErrorHandler(ErrorHandler*   handler);
00238 
00248     virtual bool
00249     getDoNamespaces() const;
00250 
00268     virtual void
00269     setDoNamespaces(bool    newState);
00270 
00280     virtual bool
00281     getExitOnFirstFatalError() const;
00282 
00298     virtual void
00299     setExitOnFirstFatalError(bool   newState);
00300 
00307     virtual EntityResolver*
00308     getEntityResolver();
00309 
00316     virtual const EntityResolver*
00317     getEntityResolver() const;
00318 
00330     virtual void
00331     setEntityResolver(EntityResolver*   resolver);
00332 
00342     virtual XalanDocument*
00343     createDocument(const DOM_Document&  theXercesDocument);
00344 
00354     XercesDocumentBridge*
00355     mapDocument(const XalanDocument*    theDocument) const;
00356 
00366     DOM_Document
00367     mapXercesDocument(const XalanDocument*  theDocument) const;
00368 
00369     static void
00370     formatErrorMessage(const SAXParseException& e, XalanDOMString& theMessage);
00371 
00372     // Implementations for SAX ErrorHandler
00373 
00374     virtual void
00375     warning(const SAXParseException& exception);
00376 
00377     virtual void
00378     error(const SAXParseException& exception);
00379    
00380     virtual void
00381     fatalError(const SAXParseException& exception);
00382 
00383     virtual void
00384     resetErrors();
00385 
00386 #if defined(XALAN_NO_NAMESPACES)
00387     typedef map<const XalanDocument*,
00388                 XercesDocumentBridge*,
00389                 less<const XalanDocument*> >    DocumentMapType;
00390 #else
00391     typedef std::map<const XalanDocument*,
00392                      XercesDocumentBridge*>     DocumentMapType;
00393 #endif
00394 
00400     bool
00401     getBuildBridgeNodes() const
00402     
00403     {
00404         return m_buildBridge;
00405     }
00406 
00416     void
00417     setBuildBridgeNodes(bool    newState)
00418     {
00419         m_buildBridge = newState;
00420 
00421         if (newState == false)
00422         {
00423             m_threadSafe = false;
00424         }
00425     }
00426 
00436     bool
00437     getThreadSafe() const
00438     
00439     {
00440         return m_threadSafe;
00441     }
00442 
00452     void
00453     setThreadSafe(bool  newState)
00454     {
00455         m_threadSafe = newState;
00456 
00457         if (m_threadSafe == true)
00458         {
00459             m_buildBridge = true;
00460         }
00461     }
00462 
00463 protected:
00464 
00465     virtual DOMParser*
00466     CreateDOMParser();
00467 
00468     virtual SAXParser*
00469     CreateSAXParser();
00470 
00479     virtual XercesDocumentBridge*
00480     createDocument(
00481             const DOM_Document&     theXercesDocument,
00482             bool                    threadSafe,
00483             bool                    buildBridge);
00484 
00485 private:
00486 
00487     // Data members...
00488     XercesDOMSupport&   m_DOMSupport;
00489 
00490     XalanDOMString      m_specialCharacters;
00491 
00492     int                 m_indent;
00493 
00494     bool                m_shouldExpandEntityRefs;
00495 
00496     bool                m_useValidation;
00497 
00498     bool                m_includeIgnorableWhitespace;
00499 
00500     bool                m_doNamespaces;
00501 
00502     bool                m_exitOnFirstFatalError;
00503 
00504     EntityResolver*     m_entityResolver;
00505 
00506     ErrorHandler*       m_errorHandler;
00507 
00508     DocumentMapType     m_documentMap;
00509 
00510     bool                m_buildBridge;
00511 
00512     bool                m_threadSafe;
00513 
00514     ExecutionContext*   m_executionContext;
00515 };
00516 
00517 
00518 
00519 #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++ XSL Transformer Version 1.1
Copyright © 2000, 2001 The Apache Software Foundation. All Rights Reserved.