## Xalan-C++ API Documentation

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

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

# XSLTEngineImpl.hpp

Go to the documentation of this file.

    00001 /*
    00002  * The Apache Software License, Version 1.1
    00003  *
    00004  *
    00005  * Copyright (c) 1999-2002 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(XALAN_XSLTENGINEIMPL_HEADER_GUARD)
    00058 #define XALAN_XSLTENGINEIMPL_HEADER_GUARD
    00059
    00060
    00061
    00062 // Base include file.  Must be first.
    00063 #include "XSLTDefinitions.hpp"
    00064
    00065
    00066
    00067 // Base class
    00068 #include "XSLTProcessor.hpp"
    00069
    00070
    00071
    00072
    00073 // Standard library headers
    00074 #include <cassert>
    00075 #include <ctime>
    00076 #include <map>
    00077 #include <set>
    00078
    00079
    00080
    00081 #include <xalanc/XalanDOM/XalanDOMString.hpp>
    00082
    00083
    00084
    00085 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
    00086 #include <xalanc/XPath/XPathProcessor.hpp>
    00087 #endif
    00088
    00089
    00090
    00091 #include <xalanc/Include/XalanAutoPtr.hpp>
    00092
    00093
    00094
    00095 #include <xalanc/PlatformSupport/AttributeListImpl.hpp>
    00096 #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
    00097 #include <xalanc/PlatformSupport/PrefixResolver.hpp>
    00098
    00099
    00100
    00101 #include <xalanc/DOMSupport/XalanNamespacesStack.hpp>
    00102
    00103
    00104
    00105 #include <xalanc/XPath/Function.hpp>
    00106
    00107
    00108
    00109 #include <xalanc/XPath/XPathConstructionContextDefault.hpp>
    00110
    00111
    00112
    00113 #include "OutputContextStack.hpp"
    00114 #include "ProblemListenerDefault.hpp"
    00115 #include "ResultNamespacesStack.hpp"
    00116 #include "StylesheetExecutionContext.hpp"
    00117 #include "XSLTProcessorException.hpp"
    00118
    00119
    00120
    00121 XALAN_DECLARE_XERCES_CLASS(InputSource)
    00122 XALAN_DECLARE_XERCES_CLASS(DocumentHandler)
    00123
    00124
    00125
    00126 XALAN_CPP_NAMESPACE_BEGIN
    00127
    00128
    00129
    00130 typedef XERCES_CPP_NAMESPACE_QUALIFIER InputSource      InputSourceType;
    00131 typedef XERCES_CPP_NAMESPACE_QUALIFIER DocumentHandler  DocumentHandlerType;
    00132
    00133
    00134
    00135 // Forward declarations...
    00136 class DOMSupport;
    00137 class GenerateEvent;
    00138 class PrintWriter;
    00139 class ResultTreeFragBase;
    00140 class StylesheetConstructionContext;
    00141 class StylesheetExecutionContext;
    00142 class StylesheetRoot;
    00143 class XalanAttr;
    00144 class XalanSourceTreeDocument;
    00145 class XalanText;
    00146 class XMLParserLiaison;
    00147 class XObject;
    00148 class XPathEnvSupport;
    00149 class XPathFactory;
    00150 class XPathProcessor;
    00151 class XSLTResultTarget;
    00152
    00153
    00154
    00166
    00167 class XALAN_XSLT_EXPORT XSLTEngineImpl : public XSLTProcessor, public PrefixResolver
    00168 {
    00169 public:
    00170
    00171 #if defined(XALAN_STRICT_ANSI_HEADERS)
    00172     typedef std::clock_t    ClockType;
    00173 #else
    00174     typedef clock_t         ClockType;
    00175 #endif
    00176
    00177     struct LessXalanDOMStringPointers
    00178     {
    00179         bool
    00180         operator()(
    00181                 const XalanDOMString*   theLHS,
    00182                 const XalanDOMString*   theRHS) const
    00183         {
    00184             if (theLHS == 0 && theRHS != 0)
    00185             {
    00186                 return true;
    00187             }
    00188             else if (theRHS == 0)
    00189             {
    00190                 return false;
    00191             }
    00192             else
    00193             {
    00194                 return theLHS->compare(*theRHS) < 0 ? true : false;
    00195             }
    00196         }
    00197     };
    00198
    00199 #if defined(XALAN_NO_STD_NAMESPACE)
    00200     typedef map<const void*,
    00201                 ClockType,
    00202                 less<const void*> >         DurationsTableMapType;
    00203     typedef vector<const LocatorType*>      LocatorStack;
    00204     typedef vector<TraceListener*>          TraceListenerVectorType;
    00205 #if defined(XALAN_USE_DEQUE_FOR_VECTOR_BOOL)
    00206     typedef deque<bool>                     BoolVectorType;
    00207 #else
    00208     typedef vector<bool>                    BoolVectorType;
    00209 #endif
    00210     typedef vector<const XalanDOMString*>   XalanDOMStringPointerVectorType;
    00211 #else
    00212     typedef std::map<const void*, ClockType>    DurationsTableMapType;
    00213     typedef std::vector<const LocatorType*>     LocatorStack;
    00214     typedef std::vector<TraceListener*>         TraceListenerVectorType;
    00215 #if defined(XALAN_USE_DEQUE_FOR_VECTOR_BOOL)
    00216     typedef std::deque<bool>                    BoolVectorType;
    00217 #else
    00218     typedef std::vector<bool>                   BoolVectorType;
    00219 #endif
    00220     typedef std::vector<const XalanDOMString*>  XalanDOMStringPointerVectorType;
    00221 #endif
    00222
    00223     struct FindStringPointerFunctor
    00224     {
    00225         FindStringPointerFunctor(const XalanDOMString&  theString) :
    00226             m_string(theString)
    00227         {
    00228         }
    00229
    00230         bool
    00231         operator()(const XalanDOMString*    theString) const
    00232         {
    00233             assert(theString != 0);
    00234
    00235             return *theString == m_string;
    00236         }
    00237
    00238     private:
    00239
    00240         const XalanDOMString&   m_string;
    00241     };
    00242
    00243     typedef XalanAutoPtr<XPathProcessor>                XPathProcessorPtrType;
    00244     typedef Function::XObjectArgVectorType              XObjectArgVectorType;
    00245     typedef StylesheetExecutionContext::ParamVectorType ParamVectorType;
    00246
    00247     // Public members
    00248     //---------------------------------------------------------------------
    00249
    00262     XSLTEngineImpl(
    00263             XMLParserLiaison&   parserLiaison,
    00264             XPathEnvSupport&    xpathEnvSupport,
    00265             DOMSupport&         domSupport,
    00266             XObjectFactory&     xobjectFactory,
    00267             XPathFactory&       xpathFactory);
    00268
    00269     virtual
    00270     ~XSLTEngineImpl();
    00271
    00276     static void
    00277     initialize();
    00278
    00282     static void
    00283     terminate();
    00284
    00285     // These methods are inherited from XSLTProcessor ...
    00286
    00287     virtual void
    00288     process(
    00289             const XSLTInputSource&          inputSource,
    00290             const XSLTInputSource&          stylesheetSource,
    00291             XSLTResultTarget&               outputTarget,
    00292             StylesheetConstructionContext&  constructionContext,
    00293             StylesheetExecutionContext&     executionContext);
    00294
    00295     virtual void
    00296     process(
    00297             const XSLTInputSource&          inputSource,
    00298             XSLTResultTarget&               outputTarget,
    00299             StylesheetExecutionContext&     executionContext);
    00300
    00301     virtual StylesheetRoot*
    00302     processStylesheet(
    00303             const XSLTInputSource&          stylesheetSource,
    00304             StylesheetConstructionContext&  constructionContext);
    00305
    00306     virtual StylesheetRoot*
    00307     processStylesheet(
    00308             const XalanDOMString&           xsldocURLString,
    00309             StylesheetConstructionContext&  constructionContext);
    00310
    00311     virtual XalanNode*
    00312     getSourceTreeFromInput(const XSLTInputSource&   inputSource);
    00313
    00314     virtual void
    00315     resolveTopLevelParams(StylesheetExecutionContext&   executionContext);
    00316
    00317     virtual XMLParserLiaison&
    00318     getXMLParserLiaison() const;
    00319
    00320     virtual const XalanDOMString
    00321     getUniqueNamespaceValue();
    00322
    00323     virtual void
    00324     getUniqueNamespaceValue(XalanDOMString&     theValue);
    00325
    00326     virtual void
    00327     setStylesheetParam(
    00328                     const XalanDOMString&   key,
    00329                     const XalanDOMString&   expression);
    00330
    00331     virtual void
    00332     setStylesheetParam(
    00333             const XalanDOMString&   key,
    00334             XObjectPtr              value);
    00335
    00336     virtual bool
    00337     shouldStripSourceNode(
    00338             StylesheetExecutionContext&     executionContext,
    00339             const XalanNode&                node) const;
    00340
    00341     virtual FormatterListener*
    00342     getFormatterListener() const;
    00343
    00344     virtual void
    00345     setFormatterListener(FormatterListener* flistener);
    00346
    00347     // Trace-related functions...
    00348
    00349     virtual size_type
    00350     getTraceListeners() const;
    00351
    00352     virtual void
    00353     addTraceListener(TraceListener*     tl);
    00354
    00355     virtual void
    00356     removeTraceListener(TraceListener*  tl);
    00357
    00358     virtual void
    00359     fireGenerateEvent(const GenerateEvent&  ge);
    00360
    00361     virtual void
    00362     fireTraceEvent(const TracerEvent&   te);
    00363
    00364     virtual void
    00365     fireSelectEvent(const SelectionEvent&   se);
    00366
    00367     virtual bool
    00368     getTraceSelects() const;
    00369
    00370     virtual void
    00371     setTraceSelects(bool    b);
    00372
    00373     void
    00374     traceSelect(
    00375             StylesheetExecutionContext&     executionContext,
    00376             const ElemTemplateElement&      theTemplate,
    00377             const NodeRefListBase&          nl,
    00378             const XPath*                    xpath) const;
    00379
    00380     virtual void
    00381     setQuietConflictWarnings(bool   b);
    00382
    00383     virtual void
    00384     setDiagnosticsOutput(PrintWriter*   pw);
    00385
    00386
    00387     // Inherited from PrefixResolver...
    00388
    00397     virtual const XalanDOMString*
    00398     getNamespaceForPrefix(const XalanDOMString&     prefix) const;
    00399
    00405     virtual const XalanDOMString&
    00406     getURI() const;
    00407
    00419     XalanDocument*
    00420     parseXML(
    00421             const XalanDOMString&   urlString,
    00422             DocumentHandlerType*    docHandler,
    00423             XalanDocument*          docToRegister);
    00424
    00436     XalanDocument*
    00437     parseXML(
    00438             const InputSourceType&  inputSource,
    00439             DocumentHandlerType*    docHandler,
    00440             XalanDocument*          docToRegister);
    00441
    00454     Stylesheet*
    00455     getStylesheetFromPIURL(
    00456             const XalanDOMString&           xslURLString,
    00457             XalanNode&                      fragBase,
    00458             const XalanDOMString&           xmlBaseIdent,
    00459             bool                            isRoot,
    00460             StylesheetConstructionContext&  constructionContext);
    00461
    00465     void
    00466     flushPending();
    00467
    00474     void
    00475     addResultNamespaceDecl(
    00476             const XalanDOMString&   prefix,
    00477             const XalanDOMString&   namespaceVal)
    00478     {
    00479         addResultNamespaceDecl(
    00480             prefix,
    00481             namespaceVal.c_str(),
    00482             namespaceVal.length());
    00483     }
    00484
    00492     void
    00493     addResultNamespaceDecl(
    00494             const XalanDOMString&       prefix,
    00495             const XalanDOMChar*         namespaceVal,
    00496             XalanDOMString::size_type   len)
    00497     {
    00498         m_resultNamespacesStack.addDeclaration(
    00499             prefix,
    00500             namespaceVal,
    00501             len);
    00502     }
    00503
    00512     void
    00513     addResultAttribute(
    00514             AttributeListImpl&      attList,
    00515             const XalanDOMString&   aname,
    00516             const XalanDOMString&   value)
    00517     {
    00518         addResultAttribute(
    00519             attList,
    00520             aname,
    00521             value.c_str());
    00522     }
    00523
    00532     void
    00533     addResultAttribute(
    00534             AttributeListImpl&          attList,
    00535             const XalanDOMString&       aname,
    00536             const XalanDOMChar*         value);
    00537
    00545     void
    00546     addResultAttribute(
    00547             const XalanDOMString&       aname,
    00548             const XalanDOMChar*         value)
    00549     {
    00550         assert(m_outputContextStack.empty() == false);
    00551
    00552         addResultAttribute(
    00553                 getPendingAttributesImpl(),
    00554                 aname,
    00555                 value);
    00556     }
    00557
    00565     void
    00566     addResultAttribute(
    00567             const XalanDOMString&   aname,
    00568             const XalanDOMString&   value)
    00569     {
    00570         assert(m_outputContextStack.empty() == false);
    00571
    00572         addResultAttribute(
    00573                 getPendingAttributesImpl(),
    00574                 aname,
    00575                 value);
    00576     }
    00577
    00578     void
    00579     setDocumentLocator(const LocatorType*   locator);
    00580
    00581     void
    00582     startDocument();
    00583
    00584     void
    00585     endDocument();
    00586
    00587     void
    00588     startElement(
    00589             const XalanDOMChar*     name,
    00590             AttributeListType&      atts);
    00591
    00592     void
    00593     endElement(const XalanDOMChar*  name);
    00594
    00595     void
    00596     characters (
    00597             const XalanDOMChar*         ch,
    00598             XalanDOMString::size_type   length);
    00599
    00600     void
    00601     ignorableWhitespace(
    00602             const XalanDOMChar*         ch,
    00603             XalanDOMString::size_type   length);
    00604
    00605     void
    00606     processingInstruction(
    00607             const XalanDOMChar*     target,
    00608             const XalanDOMChar*     data);
    00609
    00610     void
    00611     resetDocument();
    00612
    00620     void
    00621     characters(
    00622             const XalanDOMChar*         ch,
    00623             XalanDOMString::size_type   start,
    00624             XalanDOMString::size_type   length);
    00625
    00631     void
    00632     characters(const XalanNode&     node);
    00633
    00639     void
    00640     characters(const XObjectPtr&    xobject);
    00641
    00648     void
    00649     startElement(const XalanDOMChar*    name);
    00650
    00660     void
    00661     charactersRaw(
    00662             const XalanDOMChar*         ch,
    00663             XalanDOMString::size_type   start,
    00664             XalanDOMString::size_type   length);
    00665
    00671     void
    00672     charactersRaw(const XalanNode&  node);
    00673
    00679     void
    00680     charactersRaw(const XObjectPtr&     xobject);
    00681
    00687     void
    00688     comment(const XalanDOMChar*     data);
    00689
    00696     void
    00697     entityReference(const XalanDOMChar*     data);
    00698
    00706     void
    00707     cdata(
    00708             const XalanDOMChar*         ch,
    00709             XalanDOMString::size_type   start,
    00710             XalanDOMString::size_type   length);
    00711
    00719     void
    00720     cloneToResultTree(
    00721             const XalanNode&    node,
    00722             bool                cloneTextNodesOnly,
    00723             const LocatorType*  locator);
    00724
    00736     void
    00737     cloneToResultTree(
    00738             const XalanNode&        node,
    00739             XalanNode::NodeType     nodeType,
    00740             bool                    isLiteral,
    00741             bool                    overrideStrip,
    00742             bool                    shouldCloneAttributes,
    00743             bool                    cloneTextNodesOnly,
    00744             const LocatorType*      locator);
    00745
    00753     void
    00754     outputToResultTree(
    00755             const XObject&      value,
    00756             bool                outputTextNodesOnly,
    00757             const LocatorType*  locator);
    00758
    00767     void
    00768     outputResultTreeFragment(
    00769             const XObject&      theTree,
    00770             bool                outputTextNodesOnly,
    00771             const LocatorType*  locator)
    00772     {
    00773         outputResultTreeFragment(theTree.rtree(), outputTextNodesOnly, locator);
    00774     }
    00775
    00784     void
    00785     outputResultTreeFragment(
    00786             const XalanDocumentFragment&    theTree,
    00787             bool                            outputTextNodesOnly,
    00788             const LocatorType*              locator);
    00789
    00795     virtual const StylesheetRoot*
    00796     getStylesheetRoot() const;
    00797
    00803     virtual void
    00804     setStylesheetRoot(const StylesheetRoot*     theStylesheet);
    00805
    00811     virtual void
    00812     setExecutionContext(StylesheetExecutionContext*     theExecutionContext);
    00813
    00820     static const XalanDOMString&
    00821     getXSLNameSpaceURL()
    00822     {
    00823         return s_XSLNameSpaceURL;
    00824     }
    00825
    00831     static const XalanDOMString&
    00832     getXalanXSLNameSpaceURL()
    00833     {
    00834         return s_XalanNamespaceURL;
    00835     }
    00836
    00842     bool
    00843     getQuietConflictWarnings() const
    00844     {
    00845         return m_quietConflictWarnings;
    00846     }
    00847
    00848     virtual void
    00849     message(
    00850             const XalanDOMString&       msg,
    00851             const XalanNode*            sourceNode = 0,
    00852             const ElemTemplateElement*  styleNode = 0) const;
    00853
    00854     virtual void
    00855     message(
    00856             const XalanDOMString&   msg,
    00857             const LocatorType&      locator,
    00858             const XalanNode*        sourceNode = 0) const;
    00859
    00860     virtual void
    00861     warn(
    00862             const XalanDOMString&       msg,
    00863             const XalanNode*            sourceNode = 0,
    00864             const ElemTemplateElement*  styleNode = 0) const;
    00865
    00873     virtual void
    00874     warn(
    00875             const char*                 msg,
    00876             const XalanNode*            sourceNode = 0,
    00877             const ElemTemplateElement*  styleNode = 0) const;
    00878
    00879     virtual void
    00880     warn(
    00881             const XalanDOMString&   msg,
    00882             const LocatorType&      locator,
    00883             const XalanNode*        sourceNode = 0) const;
    00884
    00885     virtual void
    00886     error(
    00887             const XalanDOMString&       msg,
    00888             const XalanNode*            sourceNode = 0,
    00889             const ElemTemplateElement*  styleNode = 0) const;
    00890
    00891     virtual void
    00892     error(
    00893             const XalanDOMString&   msg,
    00894             const LocatorType&      locator,
    00895             const XalanNode*        sourceNode = 0) const;
    00896
    00897 public:
    00898
    00905     void
    00906     pushTime(const void*    key);
    00907
    00914     ClockType
    00915     popDuration(const void*     key);
    00916
    00924     void
    00925     displayDuration(
    00926             const XalanDOMString&   info,
    00927             const void*             key);
    00928
    00929
    00935     bool doDiagnosticsOutput()
    00936     {
    00937         return 0 != m_diagnosticsPrintWriter ? true : false;
    00938     }
    00939
    00945     void
    00946     diag(const XalanDOMString&  s) const;
    00947
    00953     void
    00954     diag(const char*    s) const;
    00955
    00962     const XalanDOMString*
    00963     getResultNamespaceForPrefix(const XalanDOMString&   prefix) const;
    00964
    00971     const XalanDOMString*
    00972     getResultPrefixForNamespace(const XalanDOMString&   theNamespace) const;
    00973
    00982     bool
    00983     isPendingResultPrefix(const XalanDOMString&     thePrefix) const;
    00984
    00993     double
    00994     evalMatchPatternStr(
    00995             const XalanDOMString&   str,
    00996             XalanNode*              context,
    00997             XPathExecutionContext&  executionContext);
    00998
    01006     const XPath*
    01007     createMatchPattern(
    01008             const XalanDOMString&   str,
    01009             const PrefixResolver&   resolver);
    01010
    01017     void
    01018     returnXPath(const XPath*    xpath);
    01019
    01025     void
    01026     copyNamespaceAttributes(const XalanNode&    src);
    01027
    01035     const XObjectPtr
    01036     evalXPathStr(
    01037             const XalanDOMString&   str,
    01038             XPathExecutionContext&  executionContext);
    01039
    01049     const XObjectPtr
    01050     evalXPathStr(
    01051             const XalanDOMString&   str,
    01052             XalanNode*              contextNode,
    01053             const PrefixResolver&   prefixResolver,
    01054             XPathExecutionContext&  executionContext);
    01055
    01065     const XObjectPtr
    01066     evalXPathStr(
    01067             const XalanDOMString&   str,
    01068             XalanNode*              contextNode,
    01069             const XalanElement&     prefixResolver,
    01070             XPathExecutionContext&  executionContext);
    01071
    01079     void
    01080     copyAttributeToTarget(
    01081             const XalanDOMString&   attrName,
    01082             const XalanDOMString&   attrValue,
    01083             AttributeListImpl&      attrList);
    01084
    01090     XPathFactory&
    01091     getXPathFactory()
    01092     {
    01093         return m_xpathFactory;
    01094     }
    01095
    01101     XPathProcessor&
    01102     getXPathProcessor()
    01103     {
    01104         return *m_xpathProcessor.get();
    01105     }
    01106
    01111     virtual void
    01112     reset();
    01113
    01119     XPathEnvSupport&
    01120     getXPathEnvSupport()
    01121     {
    01122         return m_xpathEnvSupport;
    01123     }
    01124
    01133     void
    01134     setProblemListener(ProblemListener*     l)
    01135     {
    01136         m_problemListener = l;
    01137     }
    01138
    01147     ProblemListener*
    01148     getProblemListener() const
    01149     {
    01150         return m_problemListener;
    01151     }
    01152
    01153     /*
    01154      * Push a new output context using the provided FormatterListener.
    01155      *
    01156      * @param A pointer to the FormatterListener instance for the new context.
    01157      */
    01158     void
    01159     pushOutputContext(FormatterListener*    theListener)
    01160     {
    01161         m_outputContextStack.pushContext(theListener);
    01162     }
    01163
    01164     /*
    01165      * Pop the current output context.
    01166      */
    01167     void
    01168     popOutputContext()
    01169     {
    01170         m_outputContextStack.popContext();
    01171     }
    01172
    01173     /*
    01174      * See if there is a pending start document event waiting.
    01175      * @return true if there is a start document event waiting.
    01176      */
    01177     bool
    01178     getHasPendingStartDocument() const
    01179     {
    01180         return getHasPendingStartDocumentImpl();
    01181     }
    01182
    01183     /*
    01184      * Set the pending start document event state.
    01185      * @param the new value
    01186      */
    01187     void
    01188     setHasPendingStartDocument(bool b)
    01189     {
    01190         setHasPendingStartDocumentImpl(b);
    01191     }
    01192
    01193     /*
    01194      * See if a pending start document event must be flushed.
    01195      * @return true if the event must be flushed.
    01196      */
    01197     bool
    01198     getMustFlushPendingStartDocument() const
    01199     {
    01200         return getMustFlushPendingStartDocumentImpl();
    01201     }
    01202
    01203     /*
    01204      * Set the pending start document event flush state.
    01205      * @param the new value
    01206      */
    01207     void
    01208     setMustFlushPendingStartDocument(bool   b)
    01209     {
    01210         setMustFlushPendingStartDocumentImpl(b);
    01211     }
    01212
    01218     const AttributeListType&
    01219     getPendingAttributes() const
    01220     {
    01221         return getPendingAttributesImpl();
    01222     }
    01223
    01229     void
    01230     setPendingAttributes(const AttributeListType&   pendingAttributes)
    01231     {
    01232         getPendingAttributesImpl() = pendingAttributes;
    01233     }
    01234
    01242     void
    01243     replacePendingAttribute(
    01244             const XalanDOMChar*     theName,
    01245             const XalanDOMChar*     theNewType,
    01246             const XalanDOMChar*     theNewValue)
    01247     {
    01248         // Remove the old attribute, then add the new one.  AttributeListImpl::addAttribute()
    01249         // does this for us.
    01250         getPendingAttributesImpl().addAttribute(theName, theNewType, theNewValue);
    01251     }
    01252
    01253     bool
    01254     isElementPending() const
    01255     {
    01256         return length(getPendingElementNameImpl()) != 0 ? true : false;
    01257     }
    01258
    01264     const XalanDOMString&
    01265     getPendingElementName() const
    01266     {
    01267         return getPendingElementNameImpl();
    01268     }
    01269
    01275     void
    01276     setPendingElementName(const XalanDOMString&     elementName)
    01277     {
    01278         setPendingElementNameImpl(elementName);
    01279     }
    01280
    01281     void
    01282     setPendingElementName(const XalanDOMChar*   elementName)
    01283     {
    01284         setPendingElementNameImpl(elementName);
    01285     }
    01286
    01292     const LocatorType*
    01293     getLocatorFromStack() const
    01294     {
    01295         return m_stylesheetLocatorStack.empty() == true ? 0 : m_stylesheetLocatorStack.back();
    01296     }
    01297
    01303     void
    01304     pushLocatorOnStack(const LocatorType*   locator)
    01305     {
    01306         m_stylesheetLocatorStack.push_back(locator);
    01307     }
    01308
    01312     void
    01313     popLocatorStack()
    01314     {
    01315         if (m_stylesheetLocatorStack.empty() == false)
    01316         {
    01317             m_stylesheetLocatorStack.pop_back();
    01318         }
    01319     }
    01320
    01321 protected:
    01322
    01328     const AttributeListImpl&
    01329     getPendingAttributesImpl() const
    01330     {
    01331         return m_outputContextStack.getPendingAttributes();
    01332     }
    01333
    01339     AttributeListImpl&
    01340     getPendingAttributesImpl()
    01341     {
    01342         return m_outputContextStack.getPendingAttributes();
    01343     }
    01344
    01350     void
    01351     setPendingAttributesImpl(const AttributeListType&   pendingAttributes)
    01352     {
    01353         getPendingAttributesImpl() = pendingAttributes;
    01354     }
    01355
    01361     const XalanDOMString&
    01362     getPendingElementNameImpl() const
    01363     {
    01364         return m_outputContextStack.getPendingElementName();
    01365     }
    01366
    01372     XalanDOMString&
    01373     getPendingElementNameImpl()
    01374     {
    01375         return m_outputContextStack.getPendingElementName();
    01376     }
    01377
    01383     void
    01384     setPendingElementNameImpl(const XalanDOMString&     elementName)
    01385     {
    01386         m_outputContextStack.getPendingElementName() = elementName;
    01387     }
    01388
    01394     void
    01395     setPendingElementNameImpl(const XalanDOMChar*   elementName)
    01396     {
    01397         assert(elementName != 0);
    01398
    01399         m_outputContextStack.getPendingElementName() = elementName;
    01400     }
    01401
    01402     /*
    01403      * See if there is a pending start document event waiting.
    01404      * @return true if there is a start document event waiting.
    01405      */
    01406     bool
    01407     getHasPendingStartDocumentImpl() const
    01408     {
    01409         return m_outputContextStack.getHasPendingStartDocument();
    01410     }
    01411
    01412     /*
    01413      * Set the pending start document event state.
    01414      * @param the new value
    01415      */
    01416     void
    01417     setHasPendingStartDocumentImpl(bool     b)
    01418     {
    01419         m_outputContextStack.getHasPendingStartDocument() = b;
    01420     }
    01421
    01422     /*
    01423      * See if a pending start document event must be flushed.
    01424      * @return true if the event must be flushed.
    01425      */
    01426     bool
    01427     getMustFlushPendingStartDocumentImpl() const
    01428     {
    01429         return m_outputContextStack.getMustFlushPendingStartDocument();
    01430     }
    01431
    01432     /*
    01433      * Set the pending start document event flush state.
    01434      * @param the new value
    01435      */
    01436     void
    01437     setMustFlushPendingStartDocumentImpl(bool   b)
    01438     {
    01439         m_outputContextStack.getMustFlushPendingStartDocument() = b;
    01440     }
    01441
    01442     FormatterListener*
    01443     getFormatterListenerImpl() const
    01444     {
    01445         return m_outputContextStack.getFormatterListener();
    01446     }
    01447
    01448     void
    01449     setFormatterListenerImpl(FormatterListener*     flistener)
    01450     {
    01451         m_outputContextStack.getFormatterListener() = flistener;
    01452     }
    01453
    01460     XalanDOMString  m_resultNameSpacePrefix;
    01461
    01465     XalanDOMString  m_resultNameSpaceURL;
    01466
    01467
    01472     void
    01473     copyAttributesToAttList(
    01474             const XalanNode&    node,
    01475             AttributeListImpl&  attList);
    01476
    01477     // Factory for creating xpaths.
    01478     XPathFactory&           m_xpathFactory;
    01479
    01480     // Factory for creating xobjects
    01481     XObjectFactory&         m_xobjectFactory;
    01482
    01483     // The query/pattern-matcher object.
    01484     const XPathProcessorPtrType     m_xpathProcessor;
    01485
    01490     BoolVectorType  m_cdataStack;
    01491
    01492 private:
    01493
    01500     void
    01501     warnCopyTextNodesOnly(
    01502             const XalanNode*    sourceNode,
    01503             const LocatorType*  locator);
    01504
    01512     void
    01513     cloneToResultTree(
    01514             const XalanText&    node,
    01515             bool                isLiteral,
    01516             bool                overrideStrip);
    01517
    01522     bool
    01523     pendingAttributesHasDefaultNS() const;
    01524
    01525     void
    01526     addResultNamespace(
    01527             const XalanDOMString&   thePrefix,
    01528             const XalanDOMString&   theName,
    01529             const XalanNode&        theNode,
    01530             AttributeListImpl&      thePendingAttributes,
    01531             bool                    fOnlyIfPrefixNotPresent);
    01532
    01533     void
    01534     addResultNamespace(
    01535             const XalanNode&    theNode,
    01536             AttributeListImpl&  thePendingAttributes,
    01537             bool                fOnlyIfPrefixNotPresent = false);
    01538
    01543     LocatorStack  m_stylesheetLocatorStack;
    01544
    01551     ProblemListenerDefault  m_defaultProblemListener;
    01552
    01553     ProblemListener*    m_problemListener;
    01554
    01558     const StylesheetRoot*               m_stylesheetRoot;
    01559
    01563     static const XalanDOMString&        s_XSLNameSpaceURL;  //"http://www.w3.org/1999/XSL/Transform"
    01564
    01568     static const XalanDOMString&        s_XalanNamespaceURL; // "http://xml.apache.org/xalan"
    01569
    01573     static const XalanDOMString&        s_uniqueNamespacePrefix;
    01574
    01578     bool    m_traceSelects;
    01579
    01584     bool    m_quietConflictWarnings;
    01585
    01586     /*
    01587      * A stream to print diagnostics to.
    01588      */
    01589     PrintWriter*    m_diagnosticsPrintWriter;
    01590
    01591     /* For diagnostics */
    01592     DurationsTableMapType   m_durationsTable;
    01593
    01598     TraceListenerVectorType     m_traceListeners;
    01599
    01600     void
    01601     problem(
    01602             const XalanDOMString&               msg,
    01603             ProblemListener::eClassification    classification,
    01604             const XalanNode*                    sourceNode,
    01605             const ElemTemplateElement*          styleNode) const;
    01606
    01607     void
    01608     problem(
    01609             const XalanDOMString&               msg,
    01610             ProblemListener::eClassification    classification,
    01611             const LocatorType&                  locator,
    01612             const XalanNode*                    sourceNode) const;
    01613
    01614   //==========================================================
    01615   // SECTION: Function to do with attribute handling
    01616   //==========================================================
    01617
    01621     unsigned long       m_uniqueNSValue;
    01622
    01623     ParamVectorType     m_topLevelParams;
    01624
    01625 public:
    01626
    01630     void
    01631     clearTopLevelParams()
    01632     {
    01633         m_topLevelParams.clear();
    01634     }
    01635
    01636 private:
    01637
    01638     bool
    01639     generateCDATASection() const
    01640     {
    01641         if (m_hasCDATASectionElements == false)
    01642         {
    01643             return false;
    01644         }
    01645         else
    01646         {
    01647             assert(m_cdataStack.empty() == false);
    01648
    01649             return m_cdataStack.back();
    01650         }
    01651     }
    01652
    01653     void
    01654     doFlushPending()
    01655     {
    01656         setMustFlushPendingStartDocument(true);
    01657
    01658         flushPending();
    01659     }
    01660
    01668     bool
    01669     isCDataResultElem(const XalanDOMString&     elementName) const;
    01670
    01671     void
    01672     fireCharacterGenerateEvent(
    01673             const XalanNode&    theNode,
    01674             bool                isCDATA);
    01675
    01676     void
    01677     fireCharacterGenerateEvent(
    01678             const XObjectPtr&   theXObject,
    01679             bool                isCDATA);
    01680
    01681     void
    01682     fireCharacterGenerateEvent(
    01683             const XalanDOMString&   theString,
    01684             bool                    isCDATA);
    01685
    01686     void
    01687     fireCharacterGenerateEvent(
    01688             const XalanDOMChar*         ch,
    01689             XalanDOMString::size_type   start,
    01690             XalanDOMString::size_type   length,
    01691             bool                        isCDATA);
    01692
    01693     void
    01694     checkDefaultNamespace(
    01695             const XalanDOMString&   theElementName,
    01696             const XalanDOMString&   theElementNamespaceURI);
    01697
    01698     void
    01699     error(
    01700             const char*         theMessage,
    01701             const LocatorType*  theLocator,
    01702             const XalanNode*    theSourceNode);
    01703
    01704     void
    01705     warn(
    01706             const char*         theMessage,
    01707             const LocatorType*  theLocator,
    01708             const XalanNode*    theSourceNode);
    01709
    01710
    01711     // Data members...
    01712     XMLParserLiaison&   m_parserLiaison;
    01713
    01714     XPathEnvSupport&    m_xpathEnvSupport;
    01715
    01716     DOMSupport&         m_domSupport;
    01717
    01721     StylesheetExecutionContext*     m_executionContext;
    01722
    01723     /*
    01724      * Stack of current output contexts...
    01725      */
    01726     OutputContextStack              m_outputContextStack;
    01727
    01728     /*
    01729      * Stack of current result namespaces...
    01730      */
    01731     XalanNamespacesStack            m_resultNamespacesStack;
    01732
    01733     /*
    01734      * Dummy AttributeListImpl
    01735      */
    01736     AttributeListImpl                   m_dummyAttributesList;
    01737
    01738     XalanDOMString                      m_scratchString;
    01739
    01740     XalanDOMStringPointerVectorType     m_attributeNamesVisited;
    01741
    01742     bool                                m_hasStripOrPreserveSpace;
    01743
    01744     bool                                m_hasCDATASectionElements;
    01745
    01746     XPathConstructionContextDefault     m_xpathConstructionContext;
    01747
    01748     static void
    01749     installFunctions();
    01750
    01751     static void
    01752     uninstallFunctions();
    01753
    01754
    01755     static const XalanDOMString     s_emptyString;
    01756
    01757     static const XalanDOMString&    s_stylesheetNodeName;
    01758     static const XalanDOMString&    s_typeString;
    01759     static const XalanDOMString&    s_hrefString;
    01760     static const XalanDOMString&    s_piTokenizerString;
    01761     static const XalanDOMString&    s_typeValueString1;
    01762     static const XalanDOMString&    s_typeValueString2;
    01763     static const XalanDOMString&    s_typeValueString3;
    01764     static const XalanDOMString&    s_typeValueString4;
    01765
    01766     // Not implemented...
    01767     XSLTEngineImpl(const XSLTEngineImpl&);
    01768
    01769     XSLTEngineImpl&
    01770     operator=(const XSLTEngineImpl&);
    01771
    01772     bool
    01773     operator==(const XSLTEngineImpl&) const;
    01774 };
    01775
    01776
    01777
    01778 XALAN_CPP_NAMESPACE_END
    01779
    01780
    01781
    01782 #endif  // XALAN_XSLTENGINEIMPL_HEADER_GUARD

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.6 Copyright © 2000, 2001, 2002, 2003 The Apache Software Foundation. All Rights Reserved.