Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.8

Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

XSLTEngineImpl.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2004 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #if !defined(XALAN_XSLTENGINEIMPL_HEADER_GUARD)
00017 #define XALAN_XSLTENGINEIMPL_HEADER_GUARD
00018 
00019 
00020 
00021 // Base include file.  Must be first.
00022 #include "XSLTDefinitions.hpp"
00023 
00024 
00025 
00026 // Base class
00027 #include "XSLTProcessor.hpp"
00028 
00029 
00030 
00031 
00032 // Standard library headers
00033 #include <cassert>
00034 #include <ctime>
00035 #include <map>
00036 #include <set>
00037 
00038 
00039 
00040 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00041 
00042 
00043 
00044 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
00045 #include <xalanc/XPath/XPathProcessor.hpp>
00046 #endif
00047 
00048 
00049 
00050 #include <xalanc/Include/XalanAutoPtr.hpp>
00051 
00052 
00053 
00054 #include <xalanc/PlatformSupport/AttributeListImpl.hpp>
00055 #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
00056 #include <xalanc/PlatformSupport/PrefixResolver.hpp>
00057 
00058 
00059 
00060 #include <xalanc/DOMSupport/XalanNamespacesStack.hpp>
00061 
00062 
00063 
00064 #include <xalanc/XPath/Function.hpp>
00065 
00066 
00067 
00068 #include <xalanc/XPath/XPathConstructionContextDefault.hpp>
00069 
00070 
00071 
00072 #include "OutputContextStack.hpp"
00073 #include "ProblemListenerDefault.hpp"
00074 #include "ResultNamespacesStack.hpp"
00075 #include "StylesheetExecutionContext.hpp"
00076 #include "XSLTProcessorException.hpp"
00077 
00078 
00079 
00080 XALAN_DECLARE_XERCES_CLASS(InputSource)
00081 XALAN_DECLARE_XERCES_CLASS(DocumentHandler)
00082 
00083 
00084 
00085 XALAN_CPP_NAMESPACE_BEGIN
00086 
00087 
00088 
00089 typedef XERCES_CPP_NAMESPACE_QUALIFIER InputSource      InputSourceType;
00090 typedef XERCES_CPP_NAMESPACE_QUALIFIER DocumentHandler  DocumentHandlerType;
00091 
00092 
00093 
00094 // Forward declarations...
00095 class DOMSupport;
00096 class GenerateEvent;
00097 class PrintWriter;
00098 class StylesheetConstructionContext;
00099 class StylesheetExecutionContext;
00100 class StylesheetRoot;
00101 class XalanAttr;
00102 class XalanSourceTreeDocument;
00103 class XalanText;
00104 class XMLParserLiaison;
00105 class XObject;
00106 class XPathEnvSupport;
00107 class XPathFactory;
00108 class XPathProcessor;
00109 class XSLTResultTarget;
00110 
00111 
00112 
00125 class XALAN_XSLT_EXPORT XSLTEngineImpl : public XSLTProcessor, public PrefixResolver
00126 {
00127 public:
00128 
00129 #if defined(XALAN_STRICT_ANSI_HEADERS)
00130     typedef std::clock_t    ClockType;
00131 #else
00132     typedef clock_t         ClockType;
00133 #endif
00134 
00135     struct LessXalanDOMStringPointers
00136     {
00137         bool
00138         operator()(
00139                 const XalanDOMString*   theLHS,
00140                 const XalanDOMString*   theRHS) const
00141         {
00142             if (theLHS == 0 && theRHS != 0)
00143             {
00144                 return true;
00145             }
00146             else if (theRHS == 0)
00147             {
00148                 return false;
00149             }
00150             else
00151             {
00152                 return theLHS->compare(*theRHS) < 0 ? true : false;
00153             }
00154         }
00155     };
00156 
00157 #if defined(XALAN_NO_STD_NAMESPACE)
00158     typedef map<const void*,
00159                 ClockType,
00160                 less<const void*> >         DurationsTableMapType;
00161     typedef vector<const LocatorType*>      LocatorStack;
00162     typedef vector<TraceListener*>          TraceListenerVectorType;
00163 #if defined(XALAN_USE_DEQUE_FOR_VECTOR_BOOL)
00164     typedef deque<bool>                     BoolVectorType;
00165 #else
00166     typedef vector<bool>                    BoolVectorType;
00167 #endif
00168     typedef vector<const XalanDOMString*>   XalanDOMStringPointerVectorType;
00169 #else
00170     typedef std::map<const void*, ClockType>    DurationsTableMapType;
00171     typedef std::vector<const LocatorType*>     LocatorStack;
00172     typedef std::vector<TraceListener*>         TraceListenerVectorType;
00173 #if defined(XALAN_USE_DEQUE_FOR_VECTOR_BOOL)
00174     typedef std::deque<bool>                    BoolVectorType;
00175 #else
00176     typedef std::vector<bool>                   BoolVectorType;
00177 #endif
00178     typedef std::vector<const XalanDOMString*>  XalanDOMStringPointerVectorType;
00179 #endif
00180 
00181     struct FindStringPointerFunctor
00182     {
00183         FindStringPointerFunctor(const XalanDOMString&  theString) :
00184             m_string(theString)
00185         {
00186         }
00187 
00188         bool
00189         operator()(const XalanDOMString*    theString) const
00190         {
00191             assert(theString != 0);
00192 
00193             return *theString == m_string;
00194         }
00195 
00196     private:
00197 
00198         const XalanDOMString&   m_string;
00199     };
00200 
00201     typedef XalanAutoPtr<XPathProcessor>                XPathProcessorPtrType;
00202     typedef Function::XObjectArgVectorType              XObjectArgVectorType;
00203     typedef StylesheetExecutionContext::ParamVectorType ParamVectorType;
00204 
00205     // Public members
00206     //---------------------------------------------------------------------
00207 
00220     XSLTEngineImpl(
00221             XMLParserLiaison&   parserLiaison,
00222             XPathEnvSupport&    xpathEnvSupport,
00223             DOMSupport&         domSupport,
00224             XObjectFactory&     xobjectFactory,
00225             XPathFactory&       xpathFactory);
00226 
00227     virtual
00228     ~XSLTEngineImpl();
00229 
00234     static void
00235     initialize();
00236 
00240     static void
00241     terminate();
00242 
00243     // These methods are inherited from XSLTProcessor ...
00244     
00245     virtual void
00246     process(
00247             const XSLTInputSource&          inputSource, 
00248             const XSLTInputSource&          stylesheetSource,
00249             XSLTResultTarget&               outputTarget,
00250             StylesheetConstructionContext&  constructionContext,
00251             StylesheetExecutionContext&     executionContext);
00252 
00253     virtual void
00254     process(
00255             const XSLTInputSource&          inputSource,
00256             XSLTResultTarget&               outputTarget,
00257             StylesheetExecutionContext&     executionContext);
00258 
00259     virtual StylesheetRoot*
00260     processStylesheet(
00261             const XSLTInputSource&          stylesheetSource,
00262             StylesheetConstructionContext&  constructionContext);
00263 
00264     virtual StylesheetRoot*
00265     processStylesheet(
00266             const XalanDOMString&           xsldocURLString,
00267             StylesheetConstructionContext&  constructionContext);
00268 
00269     virtual XalanNode*
00270     getSourceTreeFromInput(const XSLTInputSource&   inputSource);
00271 
00272     virtual void
00273     resolveTopLevelParams(StylesheetExecutionContext&   executionContext);
00274 
00275     virtual XMLParserLiaison&
00276     getXMLParserLiaison() const;
00277 
00278     virtual const XalanDOMString
00279     getUniqueNamespaceValue();
00280 
00281     virtual void
00282     getUniqueNamespaceValue(XalanDOMString&     theValue);
00283 
00284     virtual void
00285     setStylesheetParam( 
00286                     const XalanDOMString&   key,
00287                     const XalanDOMString&   expression);
00288 
00289     virtual void
00290     setStylesheetParam(
00291             const XalanDOMString&   key,
00292             XObjectPtr              value);
00293 
00294     virtual FormatterListener*
00295     getFormatterListener() const;
00296 
00297     virtual void
00298     setFormatterListener(FormatterListener* flistener);
00299 
00300     // Trace-related functions...
00301 
00302     virtual size_type
00303     getTraceListeners() const;
00304 
00305     virtual void
00306     addTraceListener(TraceListener*     tl);
00307 
00308     virtual void
00309     removeTraceListener(TraceListener*  tl);
00310 
00311     virtual void
00312     fireGenerateEvent(const GenerateEvent&  ge);
00313       
00314     virtual void
00315     fireTraceEvent(const TracerEvent&   te);
00316 
00317     virtual void
00318     fireSelectEvent(const SelectionEvent&   se);
00319 
00320     virtual bool
00321     getTraceSelects() const;
00322 
00323     virtual void
00324     setTraceSelects(bool    b);
00325 
00326     void
00327     traceSelect(
00328             StylesheetExecutionContext&     executionContext,
00329             const ElemTemplateElement&      theTemplate,
00330             const NodeRefListBase&          nl,
00331             const XPath*                    xpath) const;
00332 
00333     virtual void
00334     setQuietConflictWarnings(bool   b);
00335 
00336     virtual void
00337     setDiagnosticsOutput(PrintWriter*   pw);
00338 
00339 
00340     // Inherited from PrefixResolver...
00341 
00350     virtual const XalanDOMString*
00351     getNamespaceForPrefix(const XalanDOMString&     prefix) const;
00352 
00358     virtual const XalanDOMString&
00359     getURI() const;
00360 
00372     XalanDocument*
00373     parseXML(
00374             const XalanDOMString&   urlString,
00375             DocumentHandlerType*    docHandler,
00376             XalanDocument*          docToRegister);
00377 
00389     XalanDocument*
00390     parseXML(
00391             const InputSourceType&  inputSource,
00392             DocumentHandlerType*    docHandler,
00393             XalanDocument*          docToRegister);
00394 
00407     Stylesheet*
00408     getStylesheetFromPIURL(
00409             const XalanDOMString&           xslURLString,
00410             XalanNode&                      fragBase,
00411             const XalanDOMString&           xmlBaseIdent,
00412             bool                            isRoot,
00413             StylesheetConstructionContext&  constructionContext);
00414 
00418     void
00419     flushPending();
00420 
00427     void
00428     addResultNamespaceDecl(
00429             const XalanDOMString&   prefix, 
00430             const XalanDOMString&   namespaceVal)
00431     {
00432         addResultNamespaceDecl(
00433             prefix,
00434             namespaceVal.c_str(),
00435             namespaceVal.length());
00436     }
00437 
00445     void
00446     addResultNamespaceDecl(
00447             const XalanDOMString&       prefix, 
00448             const XalanDOMChar*         namespaceVal,
00449             XalanDOMString::size_type   len)
00450     {
00451         m_resultNamespacesStack.addDeclaration(
00452             prefix,
00453             namespaceVal,
00454             len);
00455     }
00456 
00465     void
00466     addResultAttribute(
00467             AttributeListImpl&      attList,
00468             const XalanDOMString&   aname,
00469             const XalanDOMString&   value)
00470     {
00471         addResultAttribute(
00472             attList,
00473             aname,
00474             value.c_str());
00475     }
00476 
00485     void
00486     addResultAttribute(
00487             AttributeListImpl&          attList,
00488             const XalanDOMString&       aname,
00489             const XalanDOMChar*         value);
00490 
00498     void
00499     addResultAttribute(
00500             const XalanDOMString&       aname,
00501             const XalanDOMChar*         value)
00502     {
00503         assert(m_outputContextStack.empty() == false);
00504 
00505         addResultAttribute(
00506                 getPendingAttributesImpl(),
00507                 aname,
00508                 value);
00509     }
00510 
00518     void
00519     addResultAttribute(
00520             const XalanDOMString&   aname,
00521             const XalanDOMString&   value)
00522     {
00523         assert(m_outputContextStack.empty() == false);
00524 
00525         addResultAttribute(
00526                 getPendingAttributesImpl(),
00527                 aname,
00528                 value);
00529     }
00530 
00531     void
00532     setDocumentLocator(const LocatorType*   locator);
00533 
00534     void
00535     startDocument();
00536 
00537     void
00538     endDocument();
00539     
00540     void
00541     startElement(
00542             const XalanDOMChar*     name,
00543             AttributeListType&      atts);
00544 
00545     void
00546     endElement(const XalanDOMChar*  name);
00547 
00548     void
00549     characters (
00550             const XalanDOMChar*         ch,
00551             XalanDOMString::size_type   length);
00552 
00553     void
00554     ignorableWhitespace(
00555             const XalanDOMChar*         ch,
00556             XalanDOMString::size_type   length);
00557 
00558     void
00559     processingInstruction(
00560             const XalanDOMChar*     target,
00561             const XalanDOMChar*     data);
00562 
00563     void
00564     resetDocument();
00565 
00573     void
00574     characters(
00575             const XalanDOMChar*         ch,
00576             XalanDOMString::size_type   start,
00577             XalanDOMString::size_type   length);
00578 
00584     void
00585     characters(const XalanNode&     node);
00586 
00592     void
00593     characters(const XObjectPtr&    xobject);
00594 
00601     void
00602     startElement(const XalanDOMChar*    name);
00603 
00613     void
00614     charactersRaw(
00615             const XalanDOMChar*         ch,
00616             XalanDOMString::size_type   start,
00617             XalanDOMString::size_type   length);
00618 
00624     void
00625     charactersRaw(const XalanNode&  node);
00626 
00632     void
00633     charactersRaw(const XObjectPtr&     xobject);
00634 
00640     void
00641     comment(const XalanDOMChar*     data);
00642 
00649     void
00650     entityReference(const XalanDOMChar*     data);
00651 
00659     void
00660     cdata(
00661             const XalanDOMChar*         ch,
00662             XalanDOMString::size_type   start,
00663             XalanDOMString::size_type   length);
00664 
00672     void
00673     cloneToResultTree(
00674             const XalanNode&    node,
00675             bool                cloneTextNodesOnly,
00676             const LocatorType*  locator);
00677 
00688     void
00689     cloneToResultTree(
00690             const XalanNode&        node,
00691             XalanNode::NodeType     nodeType,
00692             bool                    overrideStrip,
00693             bool                    shouldCloneAttributes,
00694             bool                    cloneTextNodesOnly,
00695             const LocatorType*      locator);
00696 
00704     void
00705     outputToResultTree(
00706             const XObject&      value,
00707             bool                outputTextNodesOnly,
00708             const LocatorType*  locator);
00709 
00718     void
00719     outputResultTreeFragment(
00720             const XObject&      theTree,
00721             bool                outputTextNodesOnly,
00722             const LocatorType*  locator)
00723     {
00724         outputResultTreeFragment(theTree.rtree(), outputTextNodesOnly, locator);
00725     }
00726 
00735     void
00736     outputResultTreeFragment(
00737             const XalanDocumentFragment&    theTree,
00738             bool                            outputTextNodesOnly,
00739             const LocatorType*              locator);
00740 
00746     virtual const StylesheetRoot*
00747     getStylesheetRoot() const;
00748 
00754     virtual void
00755     setStylesheetRoot(const StylesheetRoot*     theStylesheet);
00756 
00762     virtual void
00763     setExecutionContext(StylesheetExecutionContext*     theExecutionContext);
00764 
00771     static const XalanDOMString&
00772     getXSLNameSpaceURL()
00773     {
00774         return s_XSLNameSpaceURL;
00775     }
00776 
00782     static const XalanDOMString&
00783     getXalanXSLNameSpaceURL()
00784     {
00785         return s_XalanNamespaceURL;
00786     }
00787 
00793     bool
00794     getQuietConflictWarnings() const
00795     {
00796         return m_quietConflictWarnings;
00797     }
00798 
00799     virtual void
00800     message(
00801             const XalanDOMString&       msg,
00802             const XalanNode*            sourceNode = 0,
00803             const ElemTemplateElement*  styleNode = 0) const;
00804 
00805     virtual void
00806     message(
00807             const XalanDOMString&   msg,
00808             const LocatorType&      locator,
00809             const XalanNode*        sourceNode = 0) const;
00810 
00811     virtual void
00812     warn(
00813             const XalanDOMString&       msg,
00814             const XalanNode*            sourceNode = 0,
00815             const ElemTemplateElement*  styleNode = 0) const;
00816 
00824     virtual void
00825     warn(
00826             const char*                 msg,
00827             const XalanNode*            sourceNode = 0,
00828             const ElemTemplateElement*  styleNode = 0) const;
00829 
00830     virtual void
00831     warn(
00832             const XalanDOMString&   msg,
00833             const LocatorType&      locator,
00834             const XalanNode*        sourceNode = 0) const;
00835 
00836     virtual void
00837     error(
00838             const XalanDOMString&       msg,
00839             const XalanNode*            sourceNode = 0,
00840             const ElemTemplateElement*  styleNode = 0) const;
00841 
00842     virtual void
00843     error(
00844             const XalanDOMString&   msg,
00845             const LocatorType&      locator,
00846             const XalanNode*        sourceNode = 0) const;
00847 
00848 public:
00849 
00856     void
00857     pushTime(const void*    key);
00858 
00865     ClockType
00866     popDuration(const void*     key);
00867 
00875     void
00876     displayDuration(
00877             const XalanDOMString&   info,
00878             const void*             key);
00879 
00880 
00886     bool doDiagnosticsOutput()
00887     {
00888         return 0 != m_diagnosticsPrintWriter ? true : false;
00889     }
00890 
00896     void
00897     diag(const XalanDOMString&  s) const;
00898 
00904     void
00905     diag(const char*    s) const;
00906 
00913     const XalanDOMString*
00914     getResultNamespaceForPrefix(const XalanDOMString&   prefix) const;
00915 
00922     const XalanDOMString*
00923     getResultPrefixForNamespace(const XalanDOMString&   theNamespace) const;
00924 
00933     bool
00934     isPendingResultPrefix(const XalanDOMString&     thePrefix) const;
00935 
00944     double
00945     evalMatchPatternStr(
00946             const XalanDOMString&   str,
00947             XalanNode*              context,
00948             XPathExecutionContext&  executionContext);
00949 
00957     const XPath*
00958     createMatchPattern(
00959             const XalanDOMString&   str,
00960             const PrefixResolver&   resolver);
00961 
00968     void
00969     returnXPath(const XPath*    xpath);
00970 
00976     void
00977     copyNamespaceAttributes(const XalanNode&    src);
00978 
00986     const XObjectPtr
00987     evalXPathStr(
00988             const XalanDOMString&   str,
00989             XPathExecutionContext&  executionContext);
00990 
01000     const XObjectPtr
01001     evalXPathStr(
01002             const XalanDOMString&   str,
01003             XalanNode*              contextNode,
01004             const PrefixResolver&   prefixResolver,
01005             XPathExecutionContext&  executionContext);
01006 
01016     const XObjectPtr
01017     evalXPathStr(
01018             const XalanDOMString&   str,
01019             XalanNode*              contextNode,
01020             const XalanElement&     prefixResolver,
01021             XPathExecutionContext&  executionContext);
01022 
01030     void
01031     copyAttributeToTarget(
01032             const XalanDOMString&   attrName,
01033             const XalanDOMString&   attrValue,
01034             AttributeListImpl&      attrList);
01035 
01041     XPathFactory&
01042     getXPathFactory()
01043     {
01044         return m_xpathFactory;
01045     }
01046 
01052     XPathProcessor&
01053     getXPathProcessor()
01054     {
01055         return *m_xpathProcessor.get();
01056     }
01057 
01062     virtual void
01063     reset();
01064 
01070     XPathEnvSupport&
01071     getXPathEnvSupport()
01072     {
01073         return m_xpathEnvSupport;
01074     }
01075 
01084     void
01085     setProblemListener(ProblemListener*     l)
01086     {
01087         m_problemListener = l;
01088     }
01089 
01098     ProblemListener*
01099     getProblemListener() const
01100     {
01101         return m_problemListener;
01102     }
01103 
01104     /*
01105      * Push a new output context using the provided FormatterListener.
01106      *
01107      * @param A pointer to the FormatterListener instance for the new context.
01108      */
01109     void
01110     pushOutputContext(FormatterListener*    theListener)
01111     {
01112         m_outputContextStack.pushContext(theListener);
01113     }
01114 
01115     /*
01116      * Pop the current output context.
01117      */
01118     void
01119     popOutputContext()
01120     {
01121         m_outputContextStack.popContext();
01122     }
01123 
01124     /*
01125      * See if there is a pending start document event waiting.
01126      * @return true if there is a start document event waiting.
01127      */
01128     bool
01129     getHasPendingStartDocument() const
01130     {
01131         return getHasPendingStartDocumentImpl();
01132     }
01133 
01134     /*
01135      * Set the pending start document event state.
01136      * @param the new value
01137      */
01138     void
01139     setHasPendingStartDocument(bool b)
01140     {
01141         setHasPendingStartDocumentImpl(b);
01142     }
01143 
01144     /*
01145      * See if a pending start document event must be flushed.
01146      * @return true if the event must be flushed.
01147      */
01148     bool
01149     getMustFlushPendingStartDocument() const
01150     {
01151         return getMustFlushPendingStartDocumentImpl();
01152     }
01153 
01154     /*
01155      * Set the pending start document event flush state.
01156      * @param the new value
01157      */
01158     void
01159     setMustFlushPendingStartDocument(bool   b)
01160     {
01161         setMustFlushPendingStartDocumentImpl(b);
01162     }
01163 
01169     const AttributeListType&
01170     getPendingAttributes() const
01171     {
01172         return getPendingAttributesImpl();
01173     }
01174 
01180     void
01181     setPendingAttributes(const AttributeListType&   pendingAttributes)
01182     {
01183         getPendingAttributesImpl() = pendingAttributes;
01184     }
01185 
01193     void
01194     replacePendingAttribute(
01195             const XalanDOMChar*     theName,
01196             const XalanDOMChar*     theNewType,
01197             const XalanDOMChar*     theNewValue)
01198     {
01199         // Remove the old attribute, then add the new one.  AttributeListImpl::addAttribute()
01200         // does this for us.
01201         getPendingAttributesImpl().addAttribute(theName, theNewType, theNewValue);
01202     }
01203 
01204     bool
01205     isElementPending() const
01206     {
01207         return length(getPendingElementNameImpl()) != 0 ? true : false;
01208     }
01209 
01215     const XalanDOMString&
01216     getPendingElementName() const
01217     {
01218         return getPendingElementNameImpl();
01219     }
01220 
01226     void
01227     setPendingElementName(const XalanDOMString&     elementName)
01228     {
01229         setPendingElementNameImpl(elementName);
01230     }
01231 
01232     void
01233     setPendingElementName(const XalanDOMChar*   elementName)
01234     {
01235         setPendingElementNameImpl(elementName);
01236     }
01237 
01243     const LocatorType*
01244     getLocatorFromStack() const
01245     {
01246         return m_stylesheetLocatorStack.empty() == true ? 0 : m_stylesheetLocatorStack.back();
01247     }
01248 
01254     void
01255     pushLocatorOnStack(const LocatorType*   locator)
01256     {
01257         m_stylesheetLocatorStack.push_back(locator);
01258     }
01259 
01263     void
01264     popLocatorStack()
01265     {
01266         if (m_stylesheetLocatorStack.empty() == false)
01267         {
01268             m_stylesheetLocatorStack.pop_back();
01269         }
01270     }
01271 
01272 protected:
01273 
01279     const AttributeListImpl&
01280     getPendingAttributesImpl() const
01281     {
01282         return m_outputContextStack.getPendingAttributes();
01283     }
01284 
01290     AttributeListImpl&
01291     getPendingAttributesImpl()
01292     {
01293         return m_outputContextStack.getPendingAttributes();
01294     }
01295 
01301     void
01302     setPendingAttributesImpl(const AttributeListType&   pendingAttributes)
01303     {
01304         getPendingAttributesImpl() = pendingAttributes;
01305     }
01306 
01312     const XalanDOMString&
01313     getPendingElementNameImpl() const
01314     {
01315         return m_outputContextStack.getPendingElementName();
01316     }
01317 
01323     XalanDOMString&
01324     getPendingElementNameImpl()
01325     {
01326         return m_outputContextStack.getPendingElementName();
01327     }
01328 
01334     void
01335     setPendingElementNameImpl(const XalanDOMString&     elementName)
01336     {
01337         m_outputContextStack.getPendingElementName() = elementName;
01338     }
01339 
01345     void
01346     setPendingElementNameImpl(const XalanDOMChar*   elementName)
01347     {
01348         assert(elementName != 0);
01349 
01350         m_outputContextStack.getPendingElementName() = elementName;
01351     }
01352 
01353     /*
01354      * See if there is a pending start document event waiting.
01355      * @return true if there is a start document event waiting.
01356      */
01357     bool
01358     getHasPendingStartDocumentImpl() const
01359     {
01360         return m_outputContextStack.getHasPendingStartDocument();
01361     }
01362 
01363     /*
01364      * Set the pending start document event state.
01365      * @param the new value
01366      */
01367     void
01368     setHasPendingStartDocumentImpl(bool     b)
01369     {
01370         m_outputContextStack.getHasPendingStartDocument() = b;
01371     }
01372 
01373     /*
01374      * See if a pending start document event must be flushed.
01375      * @return true if the event must be flushed.
01376      */
01377     bool
01378     getMustFlushPendingStartDocumentImpl() const
01379     {
01380         return m_outputContextStack.getMustFlushPendingStartDocument();
01381     }
01382 
01383     /*
01384      * Set the pending start document event flush state.
01385      * @param the new value
01386      */
01387     void
01388     setMustFlushPendingStartDocumentImpl(bool   b)
01389     {
01390         m_outputContextStack.getMustFlushPendingStartDocument() = b;
01391     }
01392 
01393     FormatterListener*
01394     getFormatterListenerImpl() const
01395     {
01396         return m_outputContextStack.getFormatterListener();
01397     }
01398 
01399     void
01400     setFormatterListenerImpl(FormatterListener*     flistener)
01401     {
01402         m_outputContextStack.getFormatterListener() = flistener;
01403     }
01404 
01411     XalanDOMString  m_resultNameSpacePrefix;
01412 
01416     XalanDOMString  m_resultNameSpaceURL;
01417 
01418 
01423     void
01424     copyAttributesToAttList(
01425             const XalanNode&    node,
01426             AttributeListImpl&  attList);
01427 
01428     // Factory for creating xpaths.
01429     XPathFactory&           m_xpathFactory;
01430 
01431     // Factory for creating xobjects
01432     XObjectFactory&         m_xobjectFactory;
01433 
01434     // The query/pattern-matcher object.
01435     const XPathProcessorPtrType     m_xpathProcessor;
01436 
01441     BoolVectorType  m_cdataStack;
01442 
01443 private:
01444 
01451     void
01452     warnCopyTextNodesOnly(
01453             const XalanNode*    sourceNode,
01454             const LocatorType*  locator);
01455 
01462     void
01463     cloneToResultTree(
01464             const XalanText&    node,
01465             bool                overrideStrip);
01466 
01471     bool
01472     pendingAttributesHasDefaultNS() const; 
01473 
01474     void
01475     addResultNamespace(
01476             const XalanDOMString&   thePrefix,
01477             const XalanDOMString&   theName,
01478             const XalanNode&        theNode,
01479             AttributeListImpl&      thePendingAttributes,
01480             bool                    fOnlyIfPrefixNotPresent);
01481 
01482     void
01483     addResultNamespace(
01484             const XalanNode&    theNode,
01485             AttributeListImpl&  thePendingAttributes,
01486             bool                fOnlyIfPrefixNotPresent = false);
01487 
01492     LocatorStack  m_stylesheetLocatorStack;
01493 
01500     ProblemListenerDefault  m_defaultProblemListener;
01501 
01502     ProblemListener*    m_problemListener;
01503 
01507     const StylesheetRoot*               m_stylesheetRoot;
01508 
01512     static const XalanDOMString&        s_XSLNameSpaceURL;  //"http://www.w3.org/1999/XSL/Transform"
01513 
01517     static const XalanDOMString&        s_XalanNamespaceURL; // "http://xml.apache.org/xalan"
01518 
01522     static const XalanDOMString&        s_uniqueNamespacePrefix;
01523 
01527     bool    m_traceSelects;
01528 
01533     bool    m_quietConflictWarnings;
01534 
01535     /*
01536      * A stream to print diagnostics to.
01537      */
01538     PrintWriter*    m_diagnosticsPrintWriter;
01539 
01540     /* For diagnostics */
01541     DurationsTableMapType   m_durationsTable;
01542 
01547     TraceListenerVectorType     m_traceListeners;
01548     
01549     void
01550     problem(
01551             const XalanDOMString&               msg, 
01552             ProblemListener::eClassification    classification,
01553             const XalanNode*                    sourceNode,
01554             const ElemTemplateElement*          styleNode) const;
01555 
01556     void
01557     problem(
01558             const XalanDOMString&               msg, 
01559             ProblemListener::eClassification    classification,
01560             const LocatorType&                  locator,
01561             const XalanNode*                    sourceNode) const;
01562 
01563   //==========================================================
01564   // SECTION: Function to do with attribute handling
01565   //==========================================================
01566 
01570     unsigned long       m_uniqueNSValue;
01571 
01572     ParamVectorType     m_topLevelParams;
01573 
01574 public:
01575 
01579     void
01580     clearTopLevelParams()
01581     {
01582         m_topLevelParams.clear();
01583     }
01584 
01585 private:
01586 
01587     bool
01588     generateCDATASection() const
01589     {
01590         if (m_hasCDATASectionElements == false)
01591         {
01592             return false;
01593         }
01594         else
01595         {
01596             assert(m_cdataStack.empty() == false);
01597 
01598             return m_cdataStack.back();
01599         }
01600     }
01601 
01602     void
01603     doFlushPending()
01604     {
01605         setMustFlushPendingStartDocument(true);
01606 
01607         flushPending();
01608     }
01609 
01617     bool
01618     isCDataResultElem(const XalanDOMString&     elementName) const;
01619 
01620     void
01621     fireCharacterGenerateEvent(
01622             const XalanNode&    theNode,
01623             bool                isCDATA);
01624 
01625     void
01626     fireCharacterGenerateEvent(
01627             const XObjectPtr&   theXObject,
01628             bool                isCDATA);
01629 
01630     void
01631     fireCharacterGenerateEvent(
01632             const XalanDOMString&   theString,
01633             bool                    isCDATA);
01634 
01635     void
01636     fireCharacterGenerateEvent(
01637             const XalanDOMChar*         ch,
01638             XalanDOMString::size_type   start,
01639             XalanDOMString::size_type   length,
01640             bool                        isCDATA);
01641 
01642     void
01643     checkDefaultNamespace(
01644             const XalanDOMString&   theElementName,
01645             const XalanDOMString&   theElementNamespaceURI);
01646 
01647     void
01648     error(
01649             const char*         theMessage,
01650             const LocatorType*  theLocator,
01651             const XalanNode*    theSourceNode);
01652 
01653     void
01654     warn(
01655             const char*         theMessage,
01656             const LocatorType*  theLocator,
01657             const XalanNode*    theSourceNode);
01658 
01659 
01660     // Data members...
01661     XMLParserLiaison&   m_parserLiaison;
01662 
01663     XPathEnvSupport&    m_xpathEnvSupport;
01664 
01665     DOMSupport&         m_domSupport;
01666 
01670     StylesheetExecutionContext*     m_executionContext;
01671 
01672     /*
01673      * Stack of current output contexts...
01674      */
01675     OutputContextStack              m_outputContextStack;
01676 
01677     /*
01678      * Stack of current result namespaces...
01679      */
01680     XalanNamespacesStack            m_resultNamespacesStack;
01681 
01682     /*
01683      * Dummy AttributeListImpl
01684      */
01685     AttributeListImpl                   m_dummyAttributesList;
01686 
01687     XalanDOMString                      m_scratchString;
01688 
01689     XalanDOMStringPointerVectorType     m_attributeNamesVisited;
01690 
01691     bool                                m_hasCDATASectionElements;
01692 
01693     XPathConstructionContextDefault     m_xpathConstructionContext;
01694 
01695     static void
01696     installFunctions();
01697 
01698     static void
01699     uninstallFunctions();
01700 
01701 
01702     static const XalanDOMString     s_emptyString;
01703 
01704     static const XalanDOMString&    s_stylesheetNodeName;
01705     static const XalanDOMString&    s_typeString;
01706     static const XalanDOMString&    s_hrefString;
01707     static const XalanDOMString&    s_piTokenizerString;
01708     static const XalanDOMString&    s_typeValueString1;
01709     static const XalanDOMString&    s_typeValueString2;
01710     static const XalanDOMString&    s_typeValueString3;
01711     static const XalanDOMString&    s_typeValueString4;
01712 
01713     // Not implemented...
01714     XSLTEngineImpl(const XSLTEngineImpl&);
01715 
01716     XSLTEngineImpl&
01717     operator=(const XSLTEngineImpl&);
01718 
01719     bool
01720     operator==(const XSLTEngineImpl&) const;
01721 };
01722 
01723 
01724 
01725 XALAN_CPP_NAMESPACE_END
01726 
01727 
01728 
01729 #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.8
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.