Xalan-C++ API Documentation

The Xalan-C++ XSL Transformer Version 1.0

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

StylesheetHandler.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  * $ Id: $
00058  *
00059  */
00060 
00061 #if !defined(XALAN_STYLESHEETHANDLER_HEADER_GUARD)
00062 #define XALAN_STYLESHEETHANDLER_HEADER_GUARD
00063 
00064 // Base include file.   Must be first.
00065 #include "XSLTDefinitions.hpp"
00066 
00067 
00068 
00069 #include <vector>
00070 #include <set>
00071 
00072 
00073 
00074 #include <XalanDOM/XalanDOMString.hpp>
00075 
00076 
00077 
00078 #include <XMLSupport/FormatterListener.hpp>
00079 
00080 
00081 
00082 #include <XSLT/NamespacesHandler.hpp>
00083 #include <XSLT/Stylesheet.hpp>
00084 
00085 
00086 
00087 class ElemTemplate;
00088 class ElemTemplateElement;
00089 class ElemTextLiteral;
00090 class ExtensionNSHandler;
00091 class StylesheetConstructionContext;
00092 
00093 
00094 
00101 class XALAN_XSLT_EXPORT StylesheetHandler : public FormatterListener
00102 {
00103 
00104 public:
00105 
00106 #if defined(XALAN_NO_NAMESPACES)
00107     typedef vector<ElemTemplateElement*>        ElemTemplateStackType;
00108     typedef vector<ElemTextLiteral*>            ElemTextLiteralStackType;
00109     typedef set<ElemTemplateElement*,
00110                 less<ElemTemplateElement*> >    ElemTemplateSetType;
00111 #else
00112     typedef std::vector<ElemTemplateElement*>   ElemTemplateStackType;
00113     typedef std::vector<ElemTextLiteral*>       ElemTextLiteralStackType;
00114     typedef std::set<ElemTemplateElement*>      ElemTemplateSetType;
00115 #endif
00116 
00120     XalanDOMString m_includeBase;
00121 
00126     StylesheetHandler(
00127             Stylesheet&                     stylesheetTree,
00128             StylesheetConstructionContext&  constructionContext);
00129 
00130     virtual
00131     ~StylesheetHandler();
00132 
00156     virtual void characters (const XMLCh* const chars, const unsigned int length);
00157 
00168     virtual void charactersRaw(const XMLCh* const chars, const unsigned int length);
00169 
00193     virtual void cdata(const XMLCh* const ch, const unsigned int length);
00194 
00218     virtual void ignorableWhitespace (const XMLCh* const chars, const unsigned int length);
00219 
00236     virtual void processingInstruction (const XMLCh* const target, const XMLCh* const data);
00237 
00244     virtual void comment(const XMLCh* const data);
00245 
00252     virtual void entityReference(const XMLCh* const data);
00253 
00254     // These methods are inherited DocumentHandler ...
00255     
00256     // $$$ Theoretically, shouldn't need javadoc for these, since they are
00257     // inherited from DocumentHandler, but let's leave them in for now -- JMD
00258 
00284     virtual void setDocumentLocator(const Locator* const    locator);
00285 
00295     virtual void startDocument();
00296 
00308     virtual void endDocument ();
00309     
00331     virtual void startElement (const XMLCh* const name, AttributeList& attrs);
00332     
00347     virtual void endElement(const XMLCh* const name);
00348     
00354     virtual void resetDocument();
00355 
00356 protected:
00357 
00367     bool
00368     isAttrOK(
00369             const XalanDOMChar*     attrName,
00370             const AttributeList&    atts,
00371             int                     which);
00372 
00381     bool
00382     processSpaceAttr(
00383             const XalanDOMChar*     aname,
00384             const AttributeList&    atts,
00385             int                     which);
00386 
00390     void
00391     processImport(
00392             const XalanDOMChar*     name,
00393             const AttributeList&    atts);
00394 
00398     void
00399     processInclude(const XalanDOMChar*      name,
00400                    const AttributeList&     atts);
00401 
00402 private:
00403 
00404     // not implemented
00405     StylesheetHandler(const StylesheetHandler &);
00406     StylesheetHandler& operator=(const StylesheetHandler &);
00407 
00408     XalanDOMString  m_pendingException;
00409     bool            m_exceptionPending;
00410 
00414     Stylesheet& m_stylesheet;
00415 
00419     StylesheetConstructionContext&  m_constructionContext;
00420 
00424     ElemTemplateStackType   m_elemStack;
00425 
00431     ElemTemplateSetType     m_elemStackParentedElements;
00432 
00436     ElemTemplateStackType   m_strayElements;
00437 
00443     ElemTextLiteralStackType m_whiteSpaceElems;
00444 
00448     ElemTemplate* m_pTemplate;
00449     
00454     ElemTemplateElement* m_lastPopped;
00455     
00459     bool m_inTemplate;
00460     
00465     bool m_foundStylesheet;
00466     
00472     bool m_foundNotImport;
00473     
00474     // BEGIN SANJIVA CODE
00475     bool m_inLXSLTScript;
00476     XalanDOMString m_LXSLTScriptBody;
00477     XalanDOMString m_LXSLTScriptLang;
00478     XalanDOMString m_LXSLTScriptSrcURL;
00479     ExtensionNSHandler* m_pLXSLTExtensionNSH;
00480     // END SANJIVA CODE
00481     
00485     ElemTemplateElement*
00486     initWrapperless(
00487             const XalanDOMString& name,
00488             const AttributeList& atts,
00489             int lineNumber,
00490             int columnNumber);
00491 
00492 
00493     class PushPopIncludeState
00494     {
00495     public:
00496 
00497         PushPopIncludeState(StylesheetHandler&      theHandler);
00498 
00499         ~PushPopIncludeState();
00500 
00501     private:
00502 
00503         StylesheetHandler&                  m_handler;
00504 
00505         ElemTemplateStackType               m_elemStack;
00506 
00507         ElemTemplateSetType                 m_elemStackParentedElements;
00508 
00509         ElemTemplate* const                 m_pTemplate;
00510 
00511         ElemTemplateElement* const          m_lastPopped;
00512 
00513         const bool                          m_inTemplate;
00514 
00515         const bool                          m_foundStylesheet;
00516 
00517         const XalanDOMString                m_XSLNameSpaceURL;
00518 
00519         const bool                          m_foundNotImport;
00520 
00521         Stylesheet::NamespaceVectorType     m_namespaceDecls;
00522 
00523         Stylesheet::NamespacesStackType     m_namespaces;
00524 
00525         NamespacesHandler                   m_namespacesHandler;
00526     };
00527 
00528     friend class PushPopIncludeState;
00529 };
00530 
00531 
00532 
00533 #endif  // XALAN_STYLESHEETHANDLER_HEADER_GUARD

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.0
Copyright © 2000 The Apache Software Foundation. All Rights Reserved.