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 
00105     XercesParserLiaison(XercesDOMSupport&   theSupport);
00106 
00110     XercesParserLiaison();
00111 
00112     virtual
00113     ~XercesParserLiaison();
00114 
00115     // These interfaces are inherited from XMLParserLiaison...
00116 
00117     virtual void
00118     reset();
00119 
00120     virtual ExecutionContext*
00121     getExecutionContext() const;
00122 
00123     virtual void
00124     setExecutionContext(ExecutionContext&   theContext);
00125 
00126     virtual XalanDocument*
00127     parseXMLStream(
00128             const InputSource&      reader,
00129             const XalanDOMString&   identifier = XalanDOMString());
00130 
00131     virtual void
00132     parseXMLStream(
00133             const InputSource&      urlInputSource,
00134             DocumentHandler&        handler,
00135             const XalanDOMString&   identifier = XalanDOMString());
00136 
00137     // Create a non-thread safe document, with no synchronization and no bridge...
00138     virtual XalanDocument*
00139     createDocument();
00140 
00141     // Create a non-thread safe document, with no synchronization and no bridge...
00142     virtual XalanDocument*
00143     createDOMFactory();
00144 
00145     virtual void
00146     destroyDocument(XalanDocument*  theDocument);
00147 
00148     virtual unsigned long
00149     getDocumentNumber();
00150 
00151     virtual int
00152     getIndent() const;
00153 
00154     virtual void
00155     setIndent(int   i);
00156 
00157     virtual bool
00158     getUseValidation() const;
00159 
00160     virtual void
00161     setUseValidation(bool   b);
00162 
00163     virtual const XalanDOMString
00164     getParserDescription() const;
00165 
00166     virtual EntityResolver*
00167     getEntityResolver();
00168 
00169     virtual void
00170     setEntityResolver(EntityResolver*   resolver);
00171 
00172 
00173     // These interfaces are new to XercesParserLiaison...
00174 
00185     virtual bool
00186     getIncludeIgnorableWhitespace() const;
00187 
00206     virtual void
00207     setIncludeIgnorableWhitespace(bool  include);
00208 
00215     virtual ErrorHandler*
00216     getErrorHandler();
00217 
00224     virtual const ErrorHandler*
00225     getErrorHandler() const;
00226 
00237     virtual void
00238     setErrorHandler(ErrorHandler*   handler);
00239 
00249     virtual bool
00250     getDoNamespaces() const;
00251 
00269     virtual void
00270     setDoNamespaces(bool    newState);
00271 
00281     virtual bool
00282     getExitOnFirstFatalError() const;
00283 
00299     virtual void
00300     setExitOnFirstFatalError(bool   newState);
00301 
00311     virtual XalanDocument*
00312     createDocument(const DOM_Document&  theXercesDocument);
00313 
00323     XercesDocumentBridge*
00324     mapDocument(const XalanDocument*    theDocument) const;
00325 
00335     DOM_Document
00336     mapXercesDocument(const XalanDocument*  theDocument) const;
00337 
00338     // Implementations for SAX ErrorHandler
00339 
00340     virtual void
00341     warning(const SAXParseException& exception);
00342 
00343     virtual void
00344     error(const SAXParseException& exception);
00345    
00346     virtual void
00347     fatalError(const SAXParseException& exception);
00348 
00349     virtual void
00350     resetErrors();
00351 
00352 #if defined(XALAN_NO_NAMESPACES)
00353     typedef map<const XalanDocument*,
00354                 XercesDocumentBridge*,
00355                 less<const XalanDocument*> >    DocumentMapType;
00356 #else
00357     typedef std::map<const XalanDocument*,
00358                      XercesDocumentBridge*>     DocumentMapType;
00359 #endif
00360 
00366     bool
00367     getBuildBridgeNodes() const
00368     
00369     {
00370         return m_buildBridge;
00371     }
00372 
00382     void
00383     setBuildBridgeNodes(bool    newState)
00384     {
00385         m_buildBridge = newState;
00386 
00387         if (newState == false)
00388         {
00389             m_threadSafe = false;
00390         }
00391     }
00392 
00402     bool
00403     getThreadSafe() const
00404     
00405     {
00406         return m_threadSafe;
00407     }
00408 
00418     void
00419     setThreadSafe(bool  newState)
00420     {
00421         m_threadSafe = newState;
00422 
00423         if (m_threadSafe == true)
00424         {
00425             m_buildBridge = true;
00426         }
00427     }
00428 
00429 protected:
00430 
00431     static void
00432     formatErrorMessage(
00433             const SAXParseException&    e,
00434             XalanDOMString&             theMessage);
00435 
00436     virtual DOMParser*
00437     CreateDOMParser();
00438 
00439     virtual SAXParser*
00440     CreateSAXParser();
00441 
00450     virtual XercesDocumentBridge*
00451     createDocument(
00452             const DOM_Document&     theXercesDocument,
00453             bool                    threadSafe,
00454             bool                    buildBridge);
00455 
00456 private:
00457 
00458     // Data members...
00459     unsigned long       m_documentNumber;
00460 
00461     int                 m_indent;
00462 
00463     bool                m_useValidation;
00464 
00465     bool                m_includeIgnorableWhitespace;
00466 
00467     bool                m_doNamespaces;
00468 
00469     bool                m_exitOnFirstFatalError;
00470 
00471     EntityResolver*     m_entityResolver;
00472 
00473     ErrorHandler*       m_errorHandler;
00474 
00475     DocumentMapType     m_documentMap;
00476 
00477     bool                m_buildBridge;
00478 
00479     bool                m_threadSafe;
00480 
00481     ExecutionContext*   m_executionContext;
00482 };
00483 
00484 
00485 
00486 #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.