Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

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

StylesheetExecutionContextDefault.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(STYLESHEETEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680)
00017 #define STYLESHEETEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680
00018 
00019 
00020 
00021 // Base class include file.
00022 #include <xalanc/XSLT/StylesheetExecutionContext.hpp>
00023 
00024 
00025 
00026 #include <ctime>
00027 #include <memory>
00028 
00029 
00030 
00031 #include <xalanc/Include/XalanVector.hpp>
00032 #include <xalanc/Include/XalanMap.hpp>
00033 #include <xalanc/Include/XalanSet.hpp>
00034 #include <xalanc/Include/XalanObjectCache.hpp>
00035 #include <xalanc/Include/XalanObjectStackCache.hpp>
00036 
00037 
00038 #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
00039 
00040 
00041 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00042 #include <xalanc/PlatformSupport/DOMStringPrintWriter.hpp>
00043 #endif
00044 
00045 
00046 
00047 #include <xalanc/XPath/XPathExecutionContextDefault.hpp>
00048 
00049 
00050 
00051 #include <xalanc/XMLSupport/FormatterToText.hpp>
00052 
00053 
00054 
00055 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
00056 #include <xalanc/XalanSourceTree/XalanSourceTreeDocument.hpp>
00057 #endif
00058 #include <xalanc/XalanSourceTree/FormatterToSourceTree.hpp>
00059 #include <xalanc/XalanSourceTree/XalanSourceTreeDocumentFragment.hpp>
00060 
00061 
00062 
00063 #include <xalanc/XSLT/CountersTable.hpp>
00064 #include <xalanc/XSLT/NodeSorter.hpp>
00065 #include <xalanc/XSLT/Stylesheet.hpp>
00066 #include <xalanc/XSLT/VariablesStack.hpp>
00067 #include <xalanc/XSLT/XResultTreeFragAllocator.hpp>
00068 #include <xalanc/XSLT/XalanSourceTreeDocumentAllocator.hpp>
00069 #include <xalanc/XSLT/XalanSourceTreeDocumentFragmentAllocator.hpp>
00070 
00071 
00072 
00073 XALAN_CPP_NAMESPACE_BEGIN
00074 
00075 
00076 
00077 class XalanSourceTreeDocument;
00078 class XPathProcessor;
00079 class XSLTEngineImpl;
00080 
00081 typedef VariablesStack::ParamsVectorType            ParamsVectorTypeDecl;
00082 XALAN_USES_MEMORY_MANAGER(ParamsVectorTypeDecl)
00083 //
00084 // An class which provides support for executing stylesheets.
00085 //
00086 class XALAN_XSLT_EXPORT StylesheetExecutionContextDefault : public StylesheetExecutionContext
00087 {
00088 
00089 
00090 
00091 public:
00092 
00093 #if defined(XALAN_STRICT_ANSI_HEADERS)
00094     typedef std::clock_t    ClockType;
00095 #else
00096     typedef clock_t         ClockType;
00097 #endif
00098 
00099     typedef XalanVector<FormatterListener*>             FormatterListenerVectorType;
00100     typedef XalanVector<PrintWriter*>                   PrintWriterVectorType;
00101     typedef XalanVector<XalanOutputStream*>             OutputStreamVectorType;
00102 
00103     typedef XalanVector<const ElemTemplateElement*> ElementTemplateElementStackType;
00104     typedef XALAN_STD_QUALIFIER pair<const XPath*, ClockType>       XPathCacheEntry;
00105     typedef XalanMap <XalanDOMString, XPathCacheEntry>              XPathCacheMapType;
00106     typedef XalanVector<const ElemTemplate*>            CurrentTemplateStackType;
00107 
00108     typedef Stylesheet::KeyTablesTableType              KeyTablesTableType;
00109     typedef ParamsVectorTypeDecl                        ParamsVectorType;
00110  
00121     StylesheetExecutionContextDefault(
00122             MemoryManagerType&      theManager,
00123             XSLTEngineImpl&         xsltProcessor,
00124             XPathEnvSupport&        theXPathEnvSupport,
00125             DOMSupport&             theDOMSupport,
00126             XObjectFactory&         theXObjectFactory,
00127             XalanNode*              theCurrentNode = 0,
00128             const NodeRefListBase*  theContextNodeList = 0,
00129             const PrefixResolver*   thePrefixResolver = 0);
00130 
00141     explicit
00142     StylesheetExecutionContextDefault(
00143             MemoryManagerType&      theManager,
00144             XalanNode*              theCurrentNode = 0,
00145             const NodeRefListBase*  theContextNodeList = 0,
00146             const PrefixResolver*   thePrefixResolver = 0);
00147 
00148     static StylesheetExecutionContextDefault*
00149     create(
00150             MemoryManagerType&      theManager,
00151             XalanNode*              theCurrentNode = 0,
00152             const NodeRefListBase*  theContextNodeList = 0,
00153             const PrefixResolver*   thePrefixResolver = 0);
00154 
00155     virtual
00156     ~StylesheetExecutionContextDefault();
00157 
00158 
00164     void
00165     setXPathEnvSupport(XPathEnvSupport*     theSupport)
00166     {
00167         m_xpathExecutionContextDefault.setXPathEnvSupport(theSupport);
00168     }
00169 
00175     void
00176     setDOMSupport(DOMSupport*   theDOMSupport)
00177     {
00178         m_xpathExecutionContextDefault.setDOMSupport(theDOMSupport);
00179     }
00180 
00186     void
00187     setXObjectFactory(XObjectFactory*   theXObjectFactory)
00188     {
00189         m_xpathExecutionContextDefault.setXObjectFactory(theXObjectFactory);
00190 
00191         m_xobjectFactory = theXObjectFactory;
00192     }
00193 
00194 
00200     void
00201     setXSLTProcessor(XSLTEngineImpl*    theProcessor)
00202     {
00203         m_xsltProcessor = theProcessor;
00204     }
00205 
00206     bool
00207     getUsePerInstanceDocumentFactory() const
00208     {
00209         return m_usePerInstanceDocumentFactory;
00210     }
00211 
00212     void
00213     setUsePerInstanceDocumentFactory(bool   fValue)
00214     {
00215         m_usePerInstanceDocumentFactory = fValue;
00216     }
00217 
00218 
00219     // These interfaces are inherited from StylesheetExecutionContext...
00220 
00221     virtual void
00222     error(
00223             const XalanDOMString&       msg,
00224             const ElemTemplateElement&  styleNode,
00225             const XalanNode*            sourceNode = 0) const;
00226 
00227     virtual void
00228     warn(
00229             const XalanDOMString&       msg,
00230             const ElemTemplateElement&  styleNode,
00231             const XalanNode*            sourceNode = 0) const;
00232 
00233     virtual void
00234     message(
00235             const XalanDOMString&       msg,
00236             const ElemTemplateElement&  styleNode,
00237             const XalanNode*            sourceNode = 0) const;
00238 
00239     virtual bool
00240     getQuietConflictWarnings() const;
00241 
00242     virtual bool
00243     getCopyTextNodesOnly() const;
00244 
00245     virtual void
00246     pushCopyTextNodesOnly(bool copyTextNodesOnly);
00247 
00248     virtual bool
00249     popCopyTextNodesOnly();
00250 
00251 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00252     virtual void
00253     pushProcessCurrentAttribute(bool processAttribute);
00254 
00255     virtual bool
00256     popProcessCurrentAttribute();
00257 
00258     virtual void
00259     pushSkipElementAttributes(bool skipAttributes);
00260 
00261     virtual bool
00262     getSkipElementAttributes() const;
00263 
00264     virtual bool
00265     popSkipElementAttributes();
00266 
00267     virtual void
00268     pushExecuteIf(bool executeIf);
00269     
00270     virtual bool
00271     popExecuteIf();
00272 #endif
00273 
00274     virtual XalanNode*
00275     getRootDocument() const;
00276 
00277     virtual void
00278     setRootDocument(XalanNode*  theDocument);
00279 
00280     virtual void
00281     setStylesheetRoot(const StylesheetRoot*     theStylesheet);
00282 
00283     virtual const XalanQName*
00284     getCurrentMode() const;
00285 
00286     virtual void
00287     pushCurrentMode(const XalanQName*   theMode);
00288     
00289     virtual void
00290     popCurrentMode();
00291 
00292     virtual const ElemTemplate*
00293     getCurrentTemplate() const;
00294 
00295     virtual void
00296     pushCurrentTemplate(const ElemTemplate* theTemplate);
00297 
00298     virtual void
00299     popCurrentTemplate();
00300 
00301     virtual bool
00302     isElementPending() const;
00303 
00304     virtual void
00305     replacePendingAttribute(
00306             const XalanDOMChar*     theName,
00307             const XalanDOMChar*     theNewType,
00308             const XalanDOMChar*     theNewValue);
00309 
00310     virtual void
00311     pushOutputContext(FormatterListener*    flistener = 0);
00312 
00313     virtual void
00314     popOutputContext();
00315 
00316     virtual void
00317     addResultAttribute(
00318             const XalanDOMString&   aname,
00319             const XalanDOMString&   value);
00320 
00321     virtual void
00322     addResultAttribute(
00323             const XalanDOMString&   aname,
00324             const XalanDOMChar*     value);
00325 
00326     virtual void
00327     copyNamespaceAttributes(const XalanNode&    src);
00328 
00329     virtual const XalanDOMString*
00330     getResultPrefixForNamespace(const XalanDOMString&   theNamespace) const;
00331 
00332     virtual const XalanDOMString*
00333     getResultNamespaceForPrefix(const XalanDOMString&   thePrefix) const;
00334 
00335     virtual bool
00336     isPendingResultPrefix(const XalanDOMString& thePrefix);
00337 
00338     virtual void
00339     getUniqueNamespaceValue(XalanDOMString&     theValue) const;
00340 
00341     virtual FormatterListener*
00342     getFormatterListener() const;
00343 
00344     virtual void
00345     setFormatterListener(FormatterListener*     flistener);
00346 
00347     virtual int
00348     getIndent() const;
00349 
00350     virtual void
00351     setIndent(int   indentAmount);
00352 
00353     virtual const XPath*
00354     createMatchPattern(
00355             const XalanDOMString&   str,
00356             const PrefixResolver&   resolver);
00357 
00358     virtual void
00359     returnXPath(const XPath*    xpath);
00360 
00361     virtual void
00362     pushTopLevelVariables(const ParamVectorType&    topLevelParams);
00363 
00364 
00365     virtual const XObjectPtr
00366     createVariable(
00367             const XPath&                xpath,
00368             XalanNode*                  contextNode,
00369             const PrefixResolver&       resolver);
00370 
00371 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00372     virtual const XObjectPtr
00373     createVariable(
00374             const ElemTemplateElement&  templateChild,
00375             XalanNode*                  sourceNode);
00376 #endif
00377 
00378     virtual void
00379     pushVariable(
00380             const XalanQName&           name,
00381             const ElemTemplateElement*  element,
00382             const XalanDOMString&       str,
00383             XalanNode*                  contextNode,
00384             const PrefixResolver&       resolver);
00385 
00386     virtual void
00387     pushVariable(
00388             const XalanQName&           name,
00389             const XObjectPtr            val,
00390             const ElemTemplateElement*  element);
00391 
00392     virtual void
00393     pushVariable(
00394             const XalanQName&           name,
00395             const ElemVariable*         var,
00396             const ElemTemplateElement*  element);
00397 
00398     virtual void
00399     pushVariable(
00400             const XalanQName&           name,
00401             const ElemTemplateElement*  element,
00402             const XPath&                xpath,
00403             XalanNode*                  contextNode,
00404             const PrefixResolver&       resolver);
00405 
00406 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00407     virtual void
00408     pushVariable(
00409             const XalanQName&           name,
00410             const ElemTemplateElement*  element,
00411             const ElemTemplateElement&  templateChild,
00412             XalanNode*                  sourceNode);
00413 #endif
00414 
00415 
00416     virtual void
00417     pushContextMarker();
00418 
00419     virtual void
00420     popContextMarker();
00421 
00422     virtual void
00423     resolveTopLevelParams();
00424 
00425     virtual void
00426     clearTopLevelParams();
00427 
00428 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00429     virtual void beginParams();
00430 
00431     virtual void endParams();
00432 
00433     virtual void pushParam(const XalanQName& qName,const XObjectPtr& theValue);
00434 #else
00435     virtual void
00436     pushParams(const ElemTemplateElement&   xslCallTemplateElement);
00437 #endif
00438 
00439     virtual const XObjectPtr
00440     getParamVariable(const XalanQName&  theName);
00441 
00442     virtual void
00443     pushElementFrame(const ElemTemplateElement*     elem);
00444 
00445     virtual void
00446     popElementFrame();
00447 
00448     virtual int
00449     getGlobalStackFrameIndex() const;
00450 
00451     virtual int
00452     getCurrentStackFrameIndex() const;
00453 
00454     virtual void
00455     pushCurrentStackFrameIndex(int currentStackFrameIndex = -1);
00456 
00457     virtual void
00458     popCurrentStackFrameIndex();
00459 
00460     virtual void
00461     startDocument();
00462 
00463     virtual void
00464     endDocument();
00465 
00466     virtual void
00467     startElement(const XalanDOMChar*    name);
00468 
00469     virtual void
00470     endElement(const XalanDOMChar*  name);
00471 
00472     virtual void
00473     characters(
00474             const XalanDOMChar*         ch,
00475             XalanDOMString::size_type   start,
00476             XalanDOMString::size_type   length);
00477 
00478     virtual void
00479     charactersRaw(
00480             const XalanDOMChar*         ch,
00481             XalanDOMString::size_type   start,
00482             XalanDOMString::size_type   length);
00483 
00484     virtual void
00485     comment(const XalanDOMChar*     data);
00486 
00487     virtual void
00488     processingInstruction(
00489             const XalanDOMChar*     target,
00490             const XalanDOMChar*     data);
00491 
00492     virtual void
00493     flushPending();
00494 
00495     virtual void
00496     cloneToResultTree(
00497             const XalanNode&    node,
00498             const LocatorType*  locator);
00499 
00500     virtual void
00501     cloneToResultTree(
00502             const XalanNode&        node,
00503             XalanNode::NodeType     nodeType,
00504             bool                    overrideStrip,
00505             bool                    shouldCloneAttributes,
00506             const LocatorType*      locator);
00507 
00508 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00509     virtual void
00510     beginCreateXResultTreeFrag(
00511             XalanNode*                  sourceNode);
00512 
00513     
00514     virtual const XObjectPtr
00515     endCreateXResultTreeFrag();
00516 
00517     virtual void
00518     beginFormatToText(
00519             XalanDOMString&             theResult);
00520 
00521     virtual void
00522     endFormatToText();
00523 #endif
00524 
00525 
00526 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00527     virtual const XObjectPtr
00528     createXResultTreeFrag(
00529             const ElemTemplateElement&  templateChild,
00530             XalanNode*                  sourceNode);
00531 #endif
00532 
00533     virtual void
00534     outputToResultTree(
00535             const XObject&      xobj,
00536             const LocatorType*  locator);
00537 
00538     virtual void
00539     outputResultTreeFragment(
00540             const XObject&      theTree,
00541             const LocatorType*  locator);
00542 
00543     virtual const XalanDOMString&
00544     getXSLNameSpaceURL() const;
00545 
00546     virtual const XalanDOMString&
00547     getXalanXSLNameSpaceURL() const;
00548 
00549     virtual bool
00550     findOnElementRecursionStack(const ElemTemplateElement*  theElement) const;
00551 
00552     virtual void
00553     pushOnElementRecursionStack(const ElemTemplateElement*  theElement);
00554 
00555     virtual const ElemTemplateElement*
00556     popElementRecursionStack();
00557 
00558     virtual bool
00559     returnXResultTreeFrag(XResultTreeFrag*  theXResultTreeFrag);
00560 
00561     virtual eEscapeURLs
00562     getEscapeURLs() const;
00563 
00564     virtual void
00565     setEscapeURLs(eEscapeURLs   value);
00566 
00567     virtual eOmitMETATag
00568     getOmitMETATag() const;
00569 
00570     void
00571     setOmitMETATag(eOmitMETATag     value);
00572 
00573     virtual FormatterListener*
00574     createFormatterToXML(
00575             Writer&                 writer,
00576             const XalanDOMString&   version = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
00577             bool                    doIndent = false,
00578             int                     indent = eDefaultXMLIndentAmount,
00579             const XalanDOMString&   encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
00580             const XalanDOMString&   mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
00581             const XalanDOMString&   doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
00582             const XalanDOMString&   doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
00583             bool                    xmlDecl = true,
00584             const XalanDOMString&   standalone = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
00585 
00586     virtual FormatterListener*
00587     createFormatterToHTML(
00588             Writer&                 writer,
00589             const XalanDOMString&   encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
00590             const XalanDOMString&   mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
00591             const XalanDOMString&   doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
00592             const XalanDOMString&   doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
00593             bool                    doIndent = true,
00594             int                     indent = eDefaultHTMLIndentAmount,
00595             bool                    escapeURLs = true,
00596             bool                    omitMetaTag = false);
00597 
00598     virtual FormatterListener*
00599     createFormatterToText(
00600             Writer&                 writer,
00601             const XalanDOMString&   encoding);
00602 
00603 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00604     virtual NodeSorter*
00605     getNodeSorter();
00606 #else
00607     virtual NodeSorter*
00608     borrowNodeSorter();
00609 
00610     virtual bool
00611     returnNodeSorter(NodeSorter*    theSorter);
00612 #endif
00613 
00614     virtual XalanNumberFormatAutoPtr
00615     createXalanNumberFormat();
00616 
00617     // A basic class to create XalanNumberFormat instances...
00618     class XALAN_XSLT_EXPORT XalanNumberFormatFactory
00619     {
00620     public:
00621 
00622         explicit
00623         XalanNumberFormatFactory();
00624 
00625         virtual
00626         ~XalanNumberFormatFactory();
00627 
00628         virtual XalanNumberFormat*
00629         create(MemoryManagerType& theManager);
00630     };
00631 
00632     static XalanNumberFormatFactory&
00633     getDefaultXalanNumberFormatFactory()
00634     {
00635         return s_defaultXalanNumberFormatFactory;
00636     }
00637 
00645     static XalanNumberFormatFactory*
00646     installXalanNumberFormatFactory(XalanNumberFormatFactory*   theFactory);
00647 
00648 
00649     virtual tl_size_type
00650     getTraceListeners() const;
00651 
00652     virtual void
00653     fireGenerateEvent(const GenerateEvent&  ge);
00654 
00655     virtual void
00656     fireTraceEvent(const TracerEvent&   te);
00657 
00658     virtual void
00659     fireSelectEvent(const SelectionEvent&   se);
00660 
00661     virtual bool
00662     getTraceSelects() const;
00663 
00664     virtual void
00665     traceSelect(
00666             const ElemTemplateElement&  theStylesheetElement,
00667             const NodeRefListBase&      nl,
00668             const XPath*                xpath);
00669 
00670     virtual int
00671     collationCompare(
00672             const XalanDOMString&               theLHS,
00673             const XalanDOMString&               theRHS,
00674             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault);
00675 
00676     virtual int
00677     collationCompare(
00678             const XalanDOMString&               theLHS,
00679             const XalanDOMString&               theRHS,
00680             const XalanDOMString&               theLocale,
00681             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault);
00682 
00683     virtual int
00684     collationCompare(
00685             const XalanDOMChar*                 theLHS,
00686             const XalanDOMChar*                 theRHS,
00687             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault);
00688 
00689     virtual int
00690     collationCompare(
00691             const XalanDOMChar*                 theLHS,
00692             const XalanDOMChar*                 theRHS,
00693             const XalanDOMChar*                 theLocale,
00694             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault);
00695 
00696     typedef XalanCollationServices::CollationCompareFunctor     CollationCompareFunctor;
00697 
00698     class XALAN_XSLT_EXPORT DefaultCollationCompareFunctor : public CollationCompareFunctor
00699     {
00700     public:
00701 
00702         DefaultCollationCompareFunctor();
00703 
00704         virtual
00705         ~DefaultCollationCompareFunctor();
00706 
00707         virtual int
00708         operator()(
00709             const XalanDOMChar*                 theLHS,
00710             const XalanDOMChar*                 theRHS,
00711             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) const;
00712 
00713         virtual int
00714         operator()(
00715             const XalanDOMChar*                 theLHS,
00716             const XalanDOMChar*                 theRHS,
00717             const XalanDOMChar*                 theLocale,
00718             XalanCollationServices::eCaseOrder  theCaseOrder = XalanCollationServices::eDefault) const;
00719     };
00720 
00721 
00722     const CollationCompareFunctor*
00723     installCollationCompareFunctor(CollationCompareFunctor*     theFunctor);
00724 
00725     CollationCompareFunctor*
00726     uninstallCollationCompareFunctor();
00727 
00728 
00729     class XALAN_XSLT_EXPORT FormatNumberFunctor
00730     {
00731     public:
00732 
00733         FormatNumberFunctor() {};
00734 
00735         virtual
00736         ~FormatNumberFunctor() {};
00737 
00738         virtual void
00739         operator() (
00740             XPathExecutionContext&              executionContext,
00741             double                              theNumber,
00742             const XalanDOMString&               thePattern,
00743             const XalanDecimalFormatSymbols*    theDFS,
00744             XalanDOMString&                     theResult,
00745             const XalanNode*                    context = 0,
00746             const LocatorType*                  locator = 0) const = 0;
00747     };
00748 
00749     virtual void
00750     formatNumber(
00751             double                  number,
00752             const XalanDOMString&   pattern,
00753             XalanDOMString&         theResult,
00754             const XalanNode*        context = 0,
00755             const LocatorType*      locator = 0);
00756 
00757     virtual void
00758     formatNumber(
00759             double                  number,
00760             const XalanDOMString&   pattern,
00761             const XalanDOMString&   dfsName,
00762             XalanDOMString&         theResult,
00763             const XalanNode*        context = 0,
00764             const LocatorType*      locator = 0);
00765 
00766 
00767     const FormatNumberFunctor* 
00768     installFormatNumberFunctor(FormatNumberFunctor*     formatNumberFunctor);
00769     
00770     FormatNumberFunctor*
00771     uninstallFormatNumberFunctor();
00772 
00773     virtual PrintWriter*
00774     createPrintWriter(XalanOutputStream*        theTextOutputStream);
00775 
00776     virtual PrintWriter*
00777     createPrintWriter(
00778             const XalanDOMString&       theFileName,
00779             const XalanDOMString&       theEncoding);
00780 
00781     virtual PrintWriter*
00782     createPrintWriter(StreamType&   theStream);
00783 
00784     virtual PrintWriter*
00785     createPrintWriter(FILE*     theStream);
00786 
00787     virtual CountersTable&
00788     getCountersTable();
00789 
00790     virtual void
00791     characters(const XalanNode&     node);
00792 
00793     virtual void
00794     characters(const XObjectPtr&    xobject);
00795 
00796     virtual void
00797     charactersRaw(const XalanNode&  node);
00798 
00799     virtual void
00800     charactersRaw(const XObjectPtr&     xobject);
00801 
00802 
00803     // These interfaces are inherited from XPathExecutionContext...
00804 
00805     virtual void
00806     reset();
00807 
00808     virtual XalanNode*
00809     getCurrentNode() const;
00810 
00811     virtual void
00812     pushCurrentNode(XalanNode*  theCurrentNode);
00813 
00814     virtual void
00815     popCurrentNode();
00816 
00817     virtual bool
00818     isNodeAfter(
00819             const XalanNode&    node1,
00820             const XalanNode&    node2) const;
00821 
00822     virtual void
00823     pushContextNodeList(const NodeRefListBase&  theList);
00824 
00825     virtual void    
00826     popContextNodeList();
00827 
00828     virtual const NodeRefListBase&
00829     getContextNodeList() const;
00830 
00831     virtual size_type
00832     getContextNodeListLength() const;
00833 
00834     virtual size_type
00835     getContextNodeListPosition(const XalanNode&     contextNode) const;
00836 
00837     virtual bool
00838     elementAvailable(const XalanQName&  theQName) const;
00839 
00840     virtual bool
00841     elementAvailable(
00842             const XalanDOMString&   theName,
00843             const LocatorType*      locator) const;
00844 
00845     virtual bool
00846     functionAvailable(const XalanQName&     theQName) const;
00847 
00848     virtual bool
00849     functionAvailable(
00850             const XalanDOMString&   theName,
00851             const LocatorType*      locator) const;
00852 
00853     virtual const XObjectPtr
00854     extFunction(
00855             const XalanDOMString&           theNamespace,
00856             const XalanDOMString&           functionName,
00857             XalanNode*                      context,
00858             const XObjectArgVectorType&     argVec,
00859             const LocatorType*              locator);
00860 
00861     virtual XalanDocument*
00862     parseXML(
00863             MemoryManagerType&      theManager,
00864             const XalanDOMString&   urlString,
00865             const XalanDOMString&   base) const;
00866 
00867     virtual MutableNodeRefList*
00868     borrowMutableNodeRefList();
00869 
00870     virtual bool
00871     returnMutableNodeRefList(MutableNodeRefList*    theList);
00872 
00873     virtual MutableNodeRefList*
00874     createMutableNodeRefList(MemoryManagerType& theManager) const;
00875 
00876 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
00877     virtual void
00878     createUseAttributeSetIndexesOnStack();
00879 
00880     virtual UseAttributeSetIndexes&
00881     getUseAttributeSetIndexes();
00882 
00883     virtual void
00884     popUseAttributeSetIndexesFromStack();
00885     
00886     virtual void
00887     pushInvoker(const ElemTemplateElement * invoker);
00888 
00889     virtual void
00890     popInvoker();
00891 
00892     virtual const ElemTemplateElement*
00893     getInvoker() const;
00894 
00895     virtual MutableNodeRefList& 
00896     createAndPushMutableNodeRefList();
00897 
00898     virtual void 
00899     releaseAndPopMutableNodeRefList();
00900 
00901     virtual void
00902     pushXObjectPtr(const XObjectPtr& xobjectPtr);
00903 
00904     virtual void 
00905     popXObjectPtr();
00906 
00907     virtual void
00908     createAndPushNodesToTransformList(const NodeRefListBase* nodeList);
00909 
00910     virtual XalanNode* 
00911     getNextNodeToTransform();
00912 
00913     virtual void 
00914     popNodesToTransformList();
00915 
00916     virtual XalanDOMString&
00917     getAndPushCachedString();
00918 
00919     virtual XalanDOMString&
00920     getLastCachedString();
00921 
00922     virtual XalanDOMString&
00923     getAndPopCachedString();
00924 #endif
00925 
00926     virtual XalanDOMString&
00927     getCachedString();
00928 
00929     virtual bool
00930     releaseCachedString(XalanDOMString&     theString);
00931 
00932 
00933     virtual void
00934     getNodeSetByKey(
00935             XalanDocument*          doc,
00936             const XalanQName&       qname,
00937             const XalanDOMString&   ref,
00938             MutableNodeRefList&     nodelist);
00939 
00940     virtual void
00941     getNodeSetByKey(            
00942             XalanDocument*          doc,
00943             const XalanDOMString&   name,
00944             const XalanDOMString&   ref,
00945             const LocatorType*      locator,
00946             MutableNodeRefList&     nodelist);
00947 
00948     virtual const XObjectPtr
00949     getVariable(
00950             const XalanQName&   name,
00951             const LocatorType*  locator = 0);
00952 
00953     virtual const PrefixResolver*
00954     getPrefixResolver() const;
00955 
00956     virtual void
00957     setPrefixResolver(const PrefixResolver*     thePrefixResolver);
00958 
00959     virtual const XalanDOMString*
00960     getNamespaceForPrefix(const XalanDOMString&     prefix) const;
00961 
00962     virtual const XalanDOMString&
00963     findURIFromDoc(const XalanDocument*     owner) const;
00964 
00965     virtual const XalanDOMString&
00966     getUnparsedEntityURI(
00967             const XalanDOMString&   theName,
00968             const XalanDocument&    theDocument) const;
00969 
00970     virtual bool
00971     shouldStripSourceNode(const XalanText&  node);
00972 
00973     virtual XalanDocument*
00974     getSourceDocument(const XalanDOMString&     theURI) const;
00975 
00976     virtual void
00977     setSourceDocument(
00978             const XalanDOMString&   theURI,
00979             XalanDocument*          theDocument);
00980 
00981     // These interfaces are inherited from ExecutionContext...
00982 
00983     virtual void
00984     error(
00985             const XalanDOMString&   msg,
00986             const XalanNode*        sourceNode,
00987             const LocatorType*      locator) const;
00988 
00989     virtual void
00990     warn(
00991             const XalanDOMString&   msg,
00992             const XalanNode*        sourceNode,
00993             const LocatorType*      locator) const;
00994 
00995     virtual void
00996     message(
00997             const XalanDOMString&   msg,
00998             const XalanNode*    sourceNode,
00999             const LocatorType*  locator) const;
01000 
01001 
01002     class XPathCacheReturnFunctor
01003     {
01004     public:
01005 
01006         XPathCacheReturnFunctor(XSLTEngineImpl&     xsltProcessor) :
01007             m_xsltProcessor(xsltProcessor)
01008         {
01009         }
01010 
01011         void
01012         operator()(const XPathCacheMapType::value_type&     theCacheEntry);
01013 
01014     private:
01015 
01016         XSLTEngineImpl&     m_xsltProcessor;
01017     };
01018 
01023     XalanSourceTreeDocument*
01024     getSourceTreeFactory(MemoryManagerType& theManager) const;
01025 
01026 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
01027 protected:
01028 
01029     virtual FormatterToText*
01030     borrowFormatterToText();
01031 
01032     virtual bool
01033     returnFormatterToText(FormatterToText*  theFormatter);
01034 #endif
01035 
01036 private:
01037 
01038     const XalanDecimalFormatSymbols*
01039     getDecimalFormatSymbols(const XalanQName&   qname);
01040 
01041 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
01042 
01049     void
01050     getParams(
01051             const ElemTemplateElement&  xslCallTemplateElement,
01052             ParamsVectorType&           params);
01053 #endif
01054 
01061     bool
01062     isCached(const XPath*   theXPath);
01063 
01067     void
01068     clearXPathCache();
01069 
01077     void
01078     addToXPathCache(
01079             const XalanDOMString&   pattern,
01080             const XPath*            theXPath);
01081 
01082 
01086     void
01087     cleanUpTransients();
01088 
01089     XPathExecutionContextDefault    m_xpathExecutionContextDefault;
01090 
01091     XSLTEngineImpl*                 m_xsltProcessor;
01092 
01093     XalanNode*                      m_rootDocument;
01094 
01095     enum { eXPathCacheMax = 50,
01096            eDefaultParamsVectorSize = 10,
01097            eXResultTreeFragAllocatorBlockSize = 10,
01098            eDocumentAllocatorBlockSize = 10,
01099            eDocumentFragmentAllocatorBlockSize = 10,
01100            eDefaultAttributeAllocatorBlockSize = 10,
01101            eDefaultAttributeNSAllocatorBlockSize = 10,
01102            eDefaultCommentAllocatorBlockSize = 10,
01103            eDefaultElementAllocatorBlockSize = 10,
01104            eDefaultElementNSAllocatorBlockSize = 10,
01105            eDefaultPIAllocatorBlockSize = 10,
01106            eDefaultTextAllocatorBlockSize = 20,
01107            eDefaultTextIWSAllocatorBlockSize = 20 };
01108 
01109     ElementTemplateElementStackType     m_elementRecursionStack;
01110 
01111     const StylesheetRoot*               m_stylesheetRoot;
01112 
01113     FormatterListenerVectorType         m_formatterListeners;
01114 
01115     PrintWriterVectorType               m_printWriters;
01116 
01117     OutputStreamVectorType              m_outputStreams;
01118 
01119     CollationCompareFunctor*            m_collationCompareFunctor;
01120 
01121     FormatNumberFunctor *               m_formatNumberFunctor;
01122 
01126     VariablesStack                      m_variablesStack;
01127 
01128     ParamsVectorType                    m_paramsVector;
01129 
01130     XPathCacheMapType                   m_matchPatternCache;
01131 
01132     KeyTablesTableType                  m_keyTables;
01133 
01134     CountersTable                       m_countersTable;
01135 
01140     mutable XalanMemMgrAutoPtr<XalanSourceTreeDocument, true>   m_sourceTreeResultTreeFactory;
01141 
01142     // Holds the current mode.
01143     const XalanQName*                   m_mode;
01144 
01145     CurrentTemplateStackType            m_currentTemplateStack;
01146 
01147     int                                 m_indentAmount;
01148 
01149     XResultTreeFragAllocator            m_xresultTreeFragAllocator;
01150 
01151     XalanSourceTreeDocumentFragmentAllocator    m_documentFragmentAllocator;
01152 
01153     XalanSourceTreeDocumentAllocator    m_documentAllocator;
01154 
01155     typedef XalanVector<bool>       BooleanStackType;
01156     typedef XalanVector<const XalanQName*>  ModeStackType;
01157     typedef XalanVector<int>            IntStackType;
01158 
01159     BooleanStackType                    m_copyTextNodesOnlyStack;
01160     ModeStackType                       m_modeStack;
01161     IntStackType                        m_currentIndexStack;
01162 
01163 #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
01164     typedef XalanMemoryManagerObjectCacheDefault<FormatterToText>            FormatterToTextCacheType;
01165     typedef XalanMemoryManagerObjectCacheDefault<FormatterToSourceTree>     FormatterToSourceTreeCacheType;
01166     typedef XalanMemoryManagerObjectCacheDefault<NodeSorter>                NodeSorterCacheType;
01167     
01168     FormatterToTextCacheType            m_formatterToTextCache;
01169 
01170     FormatterToSourceTreeCacheType      m_formatterToSourceTreeCache;
01171 
01172     NodeSorterCacheType                 m_nodeSorterCache;
01173 #else
01174 
01175     class FormatterToTextDOMString : public FormatterToText
01176     {
01177     public:
01178 
01179         FormatterToTextDOMString(MemoryManagerType& theManager);
01180 
01181         virtual
01182         ~FormatterToTextDOMString();
01183 
01184         void
01185         setDOMString(XalanDOMString&    theString)
01186         {
01187             m_printWriter.setString(theString);
01188         }
01189 
01190     private:
01191 
01192         // These are not defined...
01193         FormatterToTextDOMString(const FormatterToTextDOMString&);
01194 
01195         FormatterToTextDOMString&
01196         operator=(const FormatterToTextDOMString&);
01197 
01198         bool
01199         operator==(const FormatterToTextDOMString&) const;
01200 
01201 
01202         // Data members...
01203         DOMStringPrintWriter    m_printWriter;
01204 
01205         static XalanDOMString   s_dummyString;
01206     };
01207 
01208     typedef XalanVector<XObjectPtr>                             XObjectPtrStackType;
01209     typedef XalanVector<ParamsVectorType>                       ParamsVectorStackType;
01210     typedef XalanVector<UseAttributeSetIndexes>                 UseAttributeSetIndexesStackType;
01211     typedef XalanObjectStackCache<MutableNodeRefList,DefaultCacheCreateFunctorMemMgr<MutableNodeRefList> >          
01212                                                                 MutableNodeRefListStackType;
01213 
01214     typedef XalanObjectStackCache<XalanDOMString,DefaultCacheCreateFunctorMemMgr<XalanDOMString> >              
01215                                                                 StringStackType;
01216 
01217     typedef XalanObjectStackCache<FormatterToTextDOMString,DefaultCacheCreateFunctorMemMgr<FormatterToTextDOMString> >
01218                                                                 FormatterToTextStackType;
01219     typedef XalanObjectStackCache<FormatterToSourceTree,DefaultCacheCreateFunctorMemMgr<FormatterToSourceTree> >
01220                                                                 FormatterToSourceTreeStackType;
01221 
01222     /*
01223      * class to maintain the list of nodes to be transformed by an element
01224      */
01225     class NodesToTransform
01226     {
01227     public:
01228         NodesToTransform(const NodeRefListBase* nodeList) : 
01229             m_nodeList(nodeList), m_index(0)
01230         {
01231             assert(m_nodeList != 0);
01232         }
01233 
01234         const NodeRefListBase* operator() () 
01235         {
01236             return m_nodeList;
01237         }
01238 
01239         NodeRefListBase::size_type& index()
01240         {
01241             return m_index;
01242         }
01243 
01244         XalanNode* next()
01245         {
01246             if (m_index < m_nodeList->getLength())
01247             {
01248                 return m_nodeList->item(m_index++);
01249             }
01250             return 0;
01251         }
01252 
01253     private:
01254         const NodeRefListBase*  m_nodeList;
01255         NodeRefListBase::size_type  m_index;
01256     };
01257 
01258     typedef XalanVector<NodesToTransform>           NodesToTransformStackType;
01259 
01260     XObjectPtrStackType                 m_xobjectPtrStack;
01261     MutableNodeRefListStackType         m_mutableNodeRefListStack;
01262     NodesToTransformStackType           m_nodesToTransformStack;
01263     BooleanStackType                    m_processCurrentAttributeStack;
01264     BooleanStackType                    m_executeIfStack;
01265     StringStackType                     m_stringStack;
01266     FormatterToTextStackType            m_formatterToTextStack;
01267     BooleanStackType                    m_skipElementAttributesStack;
01268     FormatterToSourceTreeStackType      m_formatterToSourceTreeStack;
01269     ParamsVectorStackType               m_paramsVectorStack;
01270     ElementTemplateElementStackType     m_elementInvokerStack;
01271     UseAttributeSetIndexesStackType     m_useAttributeSetIndexesStack;
01272 
01273     NodeSorter                          m_nodeSorter;
01274 #endif
01275 
01276     // If true, we will use a separate document factory for
01277     // result tree fragments.
01278     bool                                m_usePerInstanceDocumentFactory;
01279 
01280     // Determines whether or not to override the property in the stylesheet.
01281     eEscapeURLs                         m_escapeURLs;
01282 
01283     // Determines whether or not to override the property in the stylesheet.
01284     eOmitMETATag                        m_omitMETATag;
01285 
01286     bool                                m_hasStripOrPreserveSpace;
01287 
01288     static XalanNumberFormatFactory     s_defaultXalanNumberFormatFactory;
01289 
01290     static XalanNumberFormatFactory*    s_xalanNumberFormatFactory;
01291 
01292     static const DefaultCollationCompareFunctor     s_defaultCollationFunctor;
01293 
01294 };
01295 
01296 
01297 
01298 XALAN_CPP_NAMESPACE_END
01299 
01300 
01301 
01302 #endif  // STYLESHEETEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo