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  

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 
00035 
00036 
00037 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00038 
00039 
00040 
00041 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
00042 #include <xalanc/XPath/XPathProcessor.hpp>
00043 #endif
00044 
00045 
00046 
00047 #include <xalanc/Include/XalanMemMgrAutoPtr.hpp>
00048 #include <xalanc/Include/XalanMap.hpp>
00049 
00050 
00051 
00052 #include <xalanc/PlatformSupport/AttributeListImpl.hpp>
00053 #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
00054 #include <xalanc/PlatformSupport/PrefixResolver.hpp>
00055 
00056 
00057 
00058 #include <xalanc/DOMSupport/XalanNamespacesStack.hpp>
00059 
00060 
00061 
00062 #include <xalanc/XPath/Function.hpp>
00063 
00064 
00065 
00066 #include <xalanc/XPath/XPathConstructionContextDefault.hpp>
00067 
00068 
00069 
00070 #include "OutputContextStack.hpp"
00071 #include "ProblemListenerDefault.hpp"
00072 #include "ResultNamespacesStack.hpp"
00073 #include "StylesheetExecutionContext.hpp"
00074 #include "XSLTProcessorException.hpp"
00075 
00076 
00077 
00078 XALAN_DECLARE_XERCES_CLASS(InputSource)
00079 XALAN_DECLARE_XERCES_CLASS(DocumentHandler)
00080 
00081 
00082 
00083 XALAN_CPP_NAMESPACE_BEGIN
00084 
00085 
00086 
00087 typedef XERCES_CPP_NAMESPACE_QUALIFIER InputSource      InputSourceType;
00088 typedef XERCES_CPP_NAMESPACE_QUALIFIER DocumentHandler  DocumentHandlerType;
00089 
00090 
00091 
00092 // Forward declarations...
00093 class DOMSupport;
00094 class GenerateEvent;
00095 class PrintWriter;
00096 class StylesheetConstructionContext;
00097 class StylesheetRoot;
00098 class XalanAttr;
00099 class XalanSourceTreeDocument;
00100 class XalanText;
00101 class XMLParserLiaison;
00102 class XObject;
00103 class XPathEnvSupport;
00104 class XPathFactory;
00105 class XPathProcessor;
00106 class XSLTResultTarget;
00107 
00108 
00109 
00121 
00122 class XALAN_XSLT_EXPORT XSLTEngineImpl : public XSLTProcessor, public PrefixResolver
00123 {
00124 public:
00125 
00126     struct LessXalanDOMStringPointers
00127     {
00128         bool
00129         operator()(
00130                 const XalanDOMString*   theLHS,
00131                 const XalanDOMString*   theRHS) const
00132         {
00133             if (theLHS == 0 && theRHS != 0)
00134             {
00135                 return true;
00136             }
00137             else if (theRHS == 0)
00138             {
00139                 return false;
00140             }
00141             else
00142             {
00143                 return theLHS->compare(*theRHS) < 0 ? true : false;
00144             }
00145         }
00146     };
00147 
00148     typedef XalanVector<const LocatorType*>     LocatorStack;
00149     typedef XalanVector<TraceListener*>         TraceListenerVectorType;
00150     typedef XalanVector<const XalanDOMString*>  XalanDOMStringPointerVectorType;
00151 
00152     typedef XalanVector<bool>                           BoolVectorType;
00153 
00154     struct FindStringPointerFunctor
00155     {
00156         FindStringPointerFunctor(const XalanDOMString&  theString) :
00157             m_string(theString)
00158         {
00159         }
00160 
00161         bool
00162         operator()(const XalanDOMString*    theString) const
00163         {
00164             assert(theString != 0);
00165 
00166             return *theString == m_string;
00167         }
00168 
00169     private:
00170 
00171         const XalanDOMString&   m_string;
00172     };
00173 
00174     typedef XalanMemMgrAutoPtr<XPathProcessor, true>                XPathProcessorPtrType;
00175     typedef Function::XObjectArgVectorType              XObjectArgVectorType;
00176     typedef StylesheetExecutionContext::ParamVectorType ParamVectorType;
00177     typedef XPathConstructionContext::GetAndReleaseCachedString     CCGetAndReleaseCachedString;
00178     typedef XPathExecutionContext::GetAndReleaseCachedString        ECGetAndReleaseCachedString;
00179 
00180     // Public members
00181     //---------------------------------------------------------------------
00182 
00195     XSLTEngineImpl(
00196             MemoryManagerType&  theManager,
00197             XMLParserLiaison&   parserLiaison,
00198             XPathEnvSupport&    xpathEnvSupport,
00199             DOMSupport&         domSupport,
00200             XObjectFactory&     xobjectFactory,
00201             XPathFactory&       xpathFactory);
00202 
00203     virtual
00204     ~XSLTEngineImpl();
00205 
00206     MemoryManagerType&
00207     getMemoryManager()
00208     {
00209         return m_xpathConstructionContext.getMemoryManager();
00210     }
00211 
00216     static void
00217     initialize(MemoryManagerType&      theManager);
00218 
00222     static void
00223     terminate();
00224 
00225     // These methods are inherited from XSLTProcessor ...
00226     
00227     virtual void
00228     process(
00229             const XSLTInputSource&          inputSource, 
00230             const XSLTInputSource&          stylesheetSource,
00231             XSLTResultTarget&               outputTarget,
00232             StylesheetConstructionContext&  constructionContext,
00233             StylesheetExecutionContext&     executionContext);
00234 
00235     virtual void
00236     process(
00237             const XSLTInputSource&          inputSource,
00238             XSLTResultTarget&               outputTarget,
00239             StylesheetExecutionContext&     executionContext);
00240 
00241     virtual StylesheetRoot*
00242     processStylesheet(
00243             const XSLTInputSource&          stylesheetSource,
00244             StylesheetConstructionContext&  constructionContext);
00245 
00246     virtual StylesheetRoot*
00247     processStylesheet(
00248             const XalanDOMString&           xsldocURLString,
00249             StylesheetConstructionContext&  constructionContext);
00250 
00251     virtual XalanNode*
00252     getSourceTreeFromInput(const XSLTInputSource&   inputSource);
00253 
00254     virtual void
00255     resolveTopLevelParams(StylesheetExecutionContext&   executionContext);
00256 
00257     virtual XMLParserLiaison&
00258     getXMLParserLiaison() const;
00259 
00260     virtual void
00261     getUniqueNamespaceValue(XalanDOMString&     theValue);
00262 
00263     virtual void
00264     setStylesheetParam( 
00265                     const XalanDOMString&   key,
00266                     const XalanDOMString&   expression);
00267 
00268     virtual void
00269     setStylesheetParam(
00270             const XalanDOMString&   key,
00271             XObjectPtr              value);
00272 
00273     virtual FormatterListener*
00274     getFormatterListener() const;
00275 
00276     virtual void
00277     setFormatterListener(FormatterListener* flistener);
00278 
00279     // Trace-related functions...
00280 
00281     virtual size_type
00282     getTraceListeners() const;
00283 
00284     virtual void
00285     addTraceListener(TraceListener*     tl);
00286 
00287     virtual void
00288     removeTraceListener(TraceListener*  tl);
00289 
00290     virtual void
00291     fireGenerateEvent(const GenerateEvent&  ge);
00292       
00293     virtual void
00294     fireTraceEvent(const TracerEvent&   te);
00295 
00296     virtual void
00297     fireSelectEvent(const SelectionEvent&   se);
00298 
00299     virtual bool
00300     getTraceSelects() const;
00301 
00302     virtual void
00303     setTraceSelects(bool    b);
00304 
00305     void
00306     traceSelect(
00307             StylesheetExecutionContext&     executionContext,
00308             const ElemTemplateElement&      theTemplate,
00309             const NodeRefListBase&          nl,
00310             const XPath*                    xpath) const;
00311 
00312     virtual void
00313     setQuietConflictWarnings(bool   b);
00314 
00315     virtual void
00316     setDiagnosticsOutput(PrintWriter*   pw);
00317 
00318 
00319     // Inherited from PrefixResolver...
00320 
00329     virtual const XalanDOMString*
00330     getNamespaceForPrefix(const XalanDOMString&     prefix) const;
00331 
00337     virtual const XalanDOMString&
00338     getURI() const;
00339 
00351     XalanDocument*
00352     parseXML(
00353             const XalanDOMString&   urlString,
00354             DocumentHandlerType*    docHandler,
00355             XalanDocument*          docToRegister);
00356 
00368     XalanDocument*
00369     parseXML(
00370             const InputSourceType&  inputSource,
00371             DocumentHandlerType*    docHandler,
00372             XalanDocument*          docToRegister);
00373 
00386     Stylesheet*
00387     getStylesheetFromPIURL(
00388             const XalanDOMString&           xslURLString,
00389             XalanNode&                      fragBase,
00390             const XalanDOMString&           xmlBaseIdent,
00391             bool                            isRoot,
00392             StylesheetConstructionContext&  constructionContext);
00393 
00397     void
00398     flushPending();
00399 
00406     void
00407     addResultNamespaceDecl(
00408             const XalanDOMString&   prefix, 
00409             const XalanDOMString&   namespaceVal)
00410     {
00411         addResultNamespaceDecl(
00412             prefix,
00413             namespaceVal.c_str(),
00414             namespaceVal.length());
00415     }
00416 
00424     void
00425     addResultNamespaceDecl(
00426             const XalanDOMString&       prefix, 
00427             const XalanDOMChar*         namespaceVal,
00428             XalanDOMString::size_type   len)
00429     {
00430         m_resultNamespacesStack.addDeclaration(
00431             prefix,
00432             namespaceVal,
00433             len);
00434     }
00435 
00446     void
00447     addResultAttribute(
00448             AttributeListImpl&      attList,
00449             const XalanDOMString&   aname,
00450             const XalanDOMString&   value,
00451             bool                    fromCopy = false,
00452             const LocatorType*      locator = 0)
00453     {
00454         addResultAttribute(
00455             attList,
00456             aname,
00457             value.c_str(),
00458             fromCopy,
00459             locator);
00460     }
00461 
00472     void
00473     addResultAttribute(
00474             AttributeListImpl&      attList,
00475             const XalanDOMString&   aname,
00476             const XalanDOMChar*     value,
00477             bool                    fromCopy = false,
00478             const LocatorType*      locator = 0)
00479     {
00480         addResultAttribute(
00481             attList,
00482             aname,
00483             value,
00484             length(value),
00485             fromCopy,
00486             locator);
00487     }
00488 
00500     void
00501     addResultAttribute(
00502             AttributeListImpl&          attList,
00503             const XalanDOMString&       aname,
00504             const XalanDOMChar*         value,
00505             XalanDOMString::size_type   theLength,
00506             bool                        fromCopy = false,
00507             const LocatorType*          locator = 0);
00508 
00518     void
00519     addResultAttribute(
00520             const XalanDOMString&       aname,
00521             const XalanDOMChar*         value,
00522             bool                        fromCopy = false,
00523             const LocatorType*          locator = 0)
00524     {
00525         assert(m_outputContextStack.empty() == false);
00526 
00527         addResultAttribute(
00528                 getPendingAttributesImpl(),
00529                 aname,
00530                 value,
00531                 fromCopy,
00532                 locator);
00533     }
00534 
00544     void
00545     addResultAttribute(
00546             const XalanDOMString&   aname,
00547             const XalanDOMString&   value,
00548             bool                    fromCopy = false,
00549             const LocatorType*      locator = 0)
00550     {
00551         assert(m_outputContextStack.empty() == false);
00552 
00553         addResultAttribute(
00554                 getPendingAttributesImpl(),
00555                 aname,
00556                 value,
00557                 fromCopy,
00558                 locator);
00559     }
00560 
00566     void
00567     reportDuplicateNamespaceNodeError(
00568             const XalanDOMString&   theName,
00569             const LocatorType*      locator);
00570 
00571     void
00572     setDocumentLocator(const LocatorType*   locator);
00573 
00574     void
00575     startDocument();
00576 
00577     void
00578     endDocument();
00579     
00580     void
00581     startElement(
00582             const XalanDOMChar*     name,
00583             AttributeListType&      atts);
00584 
00585     void
00586     endElement(const XalanDOMChar*  name);
00587 
00588     void
00589     characters (
00590             const XalanDOMChar*         ch,
00591             XalanDOMString::size_type   length);
00592 
00593     void
00594     ignorableWhitespace(
00595             const XalanDOMChar*         ch,
00596             XalanDOMString::size_type   length);
00597 
00598     void
00599     processingInstruction(
00600             const XalanDOMChar*     target,
00601             const XalanDOMChar*     data);
00602 
00603     void
00604     resetDocument();
00605 
00613     void
00614     characters(
00615             const XalanDOMChar*         ch,
00616             XalanDOMString::size_type   start,
00617             XalanDOMString::size_type   length);
00618 
00624     void
00625     characters(const XalanNode&     node);
00626 
00632     void
00633     characters(const XObjectPtr&    xobject);
00634 
00641     void
00642     startElement(const XalanDOMChar*    name);
00643 
00653     void
00654     charactersRaw(
00655             const XalanDOMChar*         ch,
00656             XalanDOMString::size_type   start,
00657             XalanDOMString::size_type   length);
00658 
00664     void
00665     charactersRaw(const XalanNode&  node);
00666 
00672     void
00673     charactersRaw(const XObjectPtr&     xobject);
00674 
00680     void
00681     comment(const XalanDOMChar*     data);
00682 
00689     void
00690     entityReference(const XalanDOMChar*     data);
00691 
00699     void
00700     cdata(
00701             const XalanDOMChar*         ch,
00702             XalanDOMString::size_type   start,
00703             XalanDOMString::size_type   length);
00704 
00712     void
00713     cloneToResultTree(
00714             const XalanNode&    node,
00715             bool                cloneTextNodesOnly,
00716             const LocatorType*  locator);
00717 
00728     void
00729     cloneToResultTree(
00730             const XalanNode&        node,
00731             XalanNode::NodeType     nodeType,
00732             bool                    overrideStrip,
00733             bool                    shouldCloneAttributes,
00734             bool                    cloneTextNodesOnly,
00735             const LocatorType*      locator);
00736 
00744     void
00745     outputToResultTree(
00746             const XObject&      value,
00747             bool                outputTextNodesOnly,
00748             const LocatorType*  locator);
00749 
00758     void
00759     outputResultTreeFragment(
00760             const XObject&      theTree,
00761             bool                outputTextNodesOnly,
00762             const LocatorType*  locator)
00763     {
00764         outputResultTreeFragment(theTree.rtree(), outputTextNodesOnly, locator);
00765     }
00766 
00775     void
00776     outputResultTreeFragment(
00777             const XalanDocumentFragment&    theTree,
00778             bool                            outputTextNodesOnly,
00779             const LocatorType*              locator);
00780 
00786     virtual const StylesheetRoot*
00787     getStylesheetRoot() const;
00788 
00794     virtual void
00795     setStylesheetRoot(const StylesheetRoot*     theStylesheet);
00796 
00802     virtual void
00803     setExecutionContext(StylesheetExecutionContext*     theExecutionContext);
00804 
00811     static const XalanDOMString&
00812     getXSLNameSpaceURL()
00813     {
00814         return s_XSLNameSpaceURL;
00815     }
00816 
00822     static const XalanDOMString&
00823     getXalanXSLNameSpaceURL()
00824     {
00825         return s_XalanNamespaceURL;
00826     }
00827 
00833     bool
00834     getQuietConflictWarnings() const
00835     {
00836         return m_quietConflictWarnings;
00837     }
00838 
00839     virtual void
00840     message(
00841             const XalanDOMString&       msg,
00842             const XalanNode*            sourceNode = 0,
00843             const ElemTemplateElement*  styleNode = 0) const;
00844 
00845     virtual void
00846     message(
00847             const XalanDOMString&   msg,
00848             const LocatorType&      locator,
00849             const XalanNode*        sourceNode = 0) const;
00850 
00851     virtual void
00852     warn(
00853             const XalanDOMString&       msg,
00854             const XalanNode*            sourceNode = 0,
00855             const ElemTemplateElement*  styleNode = 0) const;
00856 
00857 
00858     virtual void
00859     warn(
00860             const XalanDOMString&   msg,
00861             const LocatorType&      locator,
00862             const XalanNode*        sourceNode = 0) const;
00863 
00864     virtual void
00865     error(
00866             const XalanDOMString&       msg,
00867             const XalanNode*            sourceNode = 0,
00868             const ElemTemplateElement*  styleNode = 0) const;
00869 
00870     virtual void
00871     error(
00872             const XalanDOMString&   msg,
00873             const LocatorType&      locator,
00874             const XalanNode*        sourceNode = 0) const;
00875 
00876 public:
00877 
00884     const XalanDOMString*
00885     getResultNamespaceForPrefix(const XalanDOMString&   prefix) const;
00886 
00893     const XalanDOMString*
00894     getResultPrefixForNamespace(const XalanDOMString&   theNamespace) const;
00895 
00904     bool
00905     isPendingResultPrefix(const XalanDOMString&     thePrefix) const;
00906 
00915     double
00916     evalMatchPatternStr(
00917             const XalanDOMString&   str,
00918             XalanNode*              context,
00919             XPathExecutionContext&  executionContext);
00920 
00928     const XPath*
00929     createMatchPattern(
00930             const XalanDOMString&   str,
00931             const PrefixResolver&   resolver);
00932 
00939     void
00940     returnXPath(const XPath*    xpath);
00941 
00947     void
00948     copyNamespaceAttributes(const XalanNode&    src);
00949 
00957     const XObjectPtr
00958     evalXPathStr(
00959             const XalanDOMString&   str,
00960             XPathExecutionContext&  executionContext);
00961 
00971     const XObjectPtr
00972     evalXPathStr(
00973             const XalanDOMString&   str,
00974             XalanNode*              contextNode,
00975             const PrefixResolver&   prefixResolver,
00976             XPathExecutionContext&  executionContext);
00977 
00987     const XObjectPtr
00988     evalXPathStr(
00989             const XalanDOMString&   str,
00990             XalanNode*              contextNode,
00991             const XalanElement&     prefixResolver,
00992             XPathExecutionContext&  executionContext);
00993 
01001     void
01002     copyAttributeToTarget(
01003             const XalanDOMString&   attrName,
01004             const XalanDOMString&   attrValue,
01005             AttributeListImpl&      attrList);
01006 
01012     XPathFactory&
01013     getXPathFactory()
01014     {
01015         return m_xpathFactory;
01016     }
01017 
01023     XPathProcessor&
01024     getXPathProcessor()
01025     {
01026         return *m_xpathProcessor.get();
01027     }
01028 
01033     virtual void
01034     reset();
01035 
01041     XPathEnvSupport&
01042     getXPathEnvSupport()
01043     {
01044         return m_xpathEnvSupport;
01045     }
01046 
01055     void
01056     setProblemListener(ProblemListener*     l)
01057     {
01058         m_problemListener = l;
01059     }
01060 
01069     ProblemListener*
01070     getProblemListener() const
01071     {
01072         return m_problemListener;
01073     }
01074 
01075     /*
01076      * Push a new output context using the provided FormatterListener.
01077      *
01078      * @param A pointer to the FormatterListener instance for the new context.
01079      */
01080     void
01081     pushOutputContext(FormatterListener*    theListener)
01082     {
01083         m_outputContextStack.pushContext(theListener);
01084     }
01085 
01086     /*
01087      * Pop the current output context.
01088      */
01089     void
01090     popOutputContext()
01091     {
01092         m_outputContextStack.popContext();
01093     }
01094 
01095     /*
01096      * See if there is a pending start document event waiting.
01097      * @return true if there is a start document event waiting.
01098      */
01099     bool
01100     getHasPendingStartDocument() const
01101     {
01102         return getHasPendingStartDocumentImpl();
01103     }
01104 
01105     /*
01106      * Set the pending start document event state.
01107      * @param the new value
01108      */
01109     void
01110     setHasPendingStartDocument(bool b)
01111     {
01112         setHasPendingStartDocumentImpl(b);
01113     }
01114 
01115     /*
01116      * See if a pending start document event must be flushed.
01117      * @return true if the event must be flushed.
01118      */
01119     bool
01120     getMustFlushPendingStartDocument() const
01121     {
01122         return getMustFlushPendingStartDocumentImpl();
01123     }
01124 
01125     /*
01126      * Set the pending start document event flush state.
01127      * @param the new value
01128      */
01129     void
01130     setMustFlushPendingStartDocument(bool   b)
01131     {
01132         setMustFlushPendingStartDocumentImpl(b);
01133     }
01134 
01140     const AttributeListType&
01141     getPendingAttributes() const
01142     {
01143         return getPendingAttributesImpl();
01144     }
01145 
01151     void
01152     setPendingAttributes(const AttributeListType&   pendingAttributes)
01153     {
01154         getPendingAttributesImpl() = pendingAttributes;
01155     }
01156 
01164     void
01165     replacePendingAttribute(
01166             const XalanDOMChar*     theName,
01167             const XalanDOMChar*     theNewType,
01168             const XalanDOMChar*     theNewValue)
01169     {
01170         // Remove the old attribute, then add the new one.  AttributeListImpl::addAttribute()
01171         // does this for us.
01172         getPendingAttributesImpl().addAttribute(theName, theNewType, theNewValue);
01173     }
01174 
01175     bool
01176     isElementPending() const
01177     {
01178         return length(getPendingElementNameImpl()) != 0 ? true : false;
01179     }
01180 
01186     const XalanDOMString&
01187     getPendingElementName() const
01188     {
01189         return getPendingElementNameImpl();
01190     }
01191 
01197     void
01198     setPendingElementName(const XalanDOMString&     elementName)
01199     {
01200         setPendingElementNameImpl(elementName);
01201     }
01202 
01203     void
01204     setPendingElementName(const XalanDOMChar*   elementName)
01205     {
01206         setPendingElementNameImpl(elementName);
01207     }
01208 
01214     const LocatorType*
01215     getLocatorFromStack() const
01216     {
01217         return m_stylesheetLocatorStack.empty() == true ? 0 : m_stylesheetLocatorStack.back();
01218     }
01219 
01225     void
01226     pushLocatorOnStack(const LocatorType*   locator)
01227     {
01228         m_stylesheetLocatorStack.push_back(locator);
01229     }
01230 
01234     void
01235     popLocatorStack()
01236     {
01237         if (m_stylesheetLocatorStack.empty() == false)
01238         {
01239             m_stylesheetLocatorStack.pop_back();
01240         }
01241     }
01242 
01243 protected:
01244 
01250     const AttributeListImpl&
01251     getPendingAttributesImpl() const
01252     {
01253         return m_outputContextStack.getPendingAttributes();
01254     }
01255 
01261     AttributeListImpl&
01262     getPendingAttributesImpl()
01263     {
01264         return m_outputContextStack.getPendingAttributes();
01265     }
01266 
01272     void
01273     setPendingAttributesImpl(const AttributeListType&   pendingAttributes)
01274     {
01275         getPendingAttributesImpl() = pendingAttributes;
01276     }
01277 
01283     const XalanDOMString&
01284     getPendingElementNameImpl() const
01285     {
01286         return m_outputContextStack.getPendingElementName();
01287     }
01288 
01294     XalanDOMString&
01295     getPendingElementNameImpl()
01296     {
01297         return m_outputContextStack.getPendingElementName();
01298     }
01299 
01305     void
01306     setPendingElementNameImpl(const XalanDOMString&     elementName)
01307     {
01308         m_outputContextStack.getPendingElementName() = elementName;
01309     }
01310 
01316     void
01317     setPendingElementNameImpl(const XalanDOMChar*   elementName)
01318     {
01319         assert(elementName != 0);
01320 
01321         m_outputContextStack.getPendingElementName() = elementName;
01322     }
01323 
01324     /*
01325      * See if there is a pending start document event waiting.
01326      * @return true if there is a start document event waiting.
01327      */
01328     bool
01329     getHasPendingStartDocumentImpl() const
01330     {
01331         return m_outputContextStack.getHasPendingStartDocument();
01332     }
01333 
01334     /*
01335      * Set the pending start document event state.
01336      * @param the new value
01337      */
01338     void
01339     setHasPendingStartDocumentImpl(bool     b)
01340     {
01341         m_outputContextStack.getHasPendingStartDocument() = b;
01342     }
01343 
01344     /*
01345      * See if a pending start document event must be flushed.
01346      * @return true if the event must be flushed.
01347      */
01348     bool
01349     getMustFlushPendingStartDocumentImpl() const
01350     {
01351         return m_outputContextStack.getMustFlushPendingStartDocument();
01352     }
01353 
01354     /*
01355      * Set the pending start document event flush state.
01356      * @param the new value
01357      */
01358     void
01359     setMustFlushPendingStartDocumentImpl(bool   b)
01360     {
01361         m_outputContextStack.getMustFlushPendingStartDocument() = b;
01362     }
01363 
01364     FormatterListener*
01365     getFormatterListenerImpl() const
01366     {
01367         return m_outputContextStack.getFormatterListener();
01368     }
01369 
01370     void
01371     setFormatterListenerImpl(FormatterListener*     flistener)
01372     {
01373         m_outputContextStack.getFormatterListener() = flistener;
01374     }
01375 
01382     XalanDOMString  m_resultNameSpacePrefix;
01383 
01387     XalanDOMString  m_resultNameSpaceURL;
01388 
01389 
01394     void
01395     copyAttributesToAttList(
01396             const XalanNode&    node,
01397             AttributeListImpl&  attList);
01398 
01399     // Factory for creating xpaths.
01400     XPathFactory&           m_xpathFactory;
01401 
01402     // Factory for creating xobjects
01403     XObjectFactory&         m_xobjectFactory;
01404 
01405     // The query/pattern-matcher object.
01406     const XPathProcessorPtrType     m_xpathProcessor;
01407 
01412     BoolVectorType  m_cdataStack;
01413 
01414 private:
01415 
01422     void
01423     warnCopyTextNodesOnly(
01424             const XalanNode*    sourceNode,
01425             const LocatorType*  locator);
01426 
01433     void
01434     cloneToResultTree(
01435             const XalanText&    node,
01436             bool                overrideStrip);
01437 
01442     bool
01443     pendingAttributesHasDefaultNS() const; 
01444 
01445     void
01446     addResultNamespace(
01447             const XalanDOMString&   thePrefix,
01448             const XalanDOMString&   theName,
01449             const XalanNode&        theNode,
01450             AttributeListImpl&      thePendingAttributes,
01451             bool                    fOnlyIfPrefixNotPresent);
01452 
01453     void
01454     addResultNamespace(
01455             const XalanNode&    theNode,
01456             AttributeListImpl&  thePendingAttributes,
01457             bool                fOnlyIfPrefixNotPresent = false);
01458 
01463     LocatorStack  m_stylesheetLocatorStack;
01464 
01471     ProblemListenerDefault  m_defaultProblemListener;
01472 
01473     ProblemListener*    m_problemListener;
01474 
01478     const StylesheetRoot*               m_stylesheetRoot;
01479 
01483     static const XalanDOMString&        s_XSLNameSpaceURL;  //"http://www.w3.org/1999/XSL/Transform"
01484 
01488     static const XalanDOMString&        s_XalanNamespaceURL; // "http://xml.apache.org/xalan"
01489 
01493     static const XalanDOMString&        s_uniqueNamespacePrefix;
01494 
01498     bool    m_traceSelects;
01499 
01504     bool    m_quietConflictWarnings;
01505 
01506     /*
01507      * A stream to print diagnostics to.
01508      */
01509     PrintWriter*    m_diagnosticsPrintWriter;
01510 
01515     TraceListenerVectorType     m_traceListeners;
01516     
01517     void
01518     problem(
01519             const XalanDOMString&               msg, 
01520             ProblemListener::eClassification    classification,
01521             const XalanNode*                    sourceNode,
01522             const ElemTemplateElement*          styleNode) const;
01523 
01524     void
01525     problem(
01526             const XalanDOMString&               msg, 
01527             ProblemListener::eClassification    classification,
01528             const LocatorType&                  locator,
01529             const XalanNode*                    sourceNode) const;
01530 
01531   //==========================================================
01532   // SECTION: Function to do with attribute handling
01533   //==========================================================
01534 
01538     unsigned long       m_uniqueNSValue;
01539 
01540     ParamVectorType     m_topLevelParams;
01541 
01542 public:
01543 
01547     void
01548     clearTopLevelParams()
01549     {
01550         m_topLevelParams.clear();
01551     }
01552 
01553 private:
01554 
01555     bool
01556     generateCDATASection() const
01557     {
01558         if (m_hasCDATASectionElements == false)
01559         {
01560             return false;
01561         }
01562         else
01563         {
01564             assert(m_cdataStack.empty() == false);
01565 
01566             return m_cdataStack.back();
01567         }
01568     }
01569 
01570     void
01571     doFlushPending()
01572     {
01573         setMustFlushPendingStartDocument(true);
01574 
01575         flushPending();
01576     }
01577 
01585     bool
01586     isCDataResultElem(const XalanDOMString&     elementName) const;
01587 
01588     void
01589     fireCharacterGenerateEvent(
01590             const XalanNode&    theNode,
01591             bool                isCDATA);
01592 
01593     void
01594     fireCharacterGenerateEvent(
01595             const XObjectPtr&   theXObject,
01596             bool                isCDATA);
01597 
01598     void
01599     fireCharacterGenerateEvent(
01600             const XalanDOMString&   theString,
01601             bool                    isCDATA);
01602 
01603     void
01604     fireCharacterGenerateEvent(
01605             const XalanDOMChar*         ch,
01606             XalanDOMString::size_type   start,
01607             XalanDOMString::size_type   length,
01608             bool                        isCDATA);
01609 
01610     void
01611     checkDefaultNamespace(
01612             const XalanDOMString&   theElementName,
01613             const XalanDOMString&   theElementNamespaceURI);
01614 
01615 
01616 
01617     // Data members...
01618     XMLParserLiaison&   m_parserLiaison;
01619 
01620     XPathEnvSupport&    m_xpathEnvSupport;
01621 
01622     DOMSupport&         m_domSupport;
01623 
01627     StylesheetExecutionContext*     m_executionContext;
01628 
01629     /*
01630      * Stack of current output contexts...
01631      */
01632     OutputContextStack              m_outputContextStack;
01633 
01634     /*
01635      * Stack of current result namespaces...
01636      */
01637     XalanNamespacesStack            m_resultNamespacesStack;
01638 
01639     /*
01640      * Dummy AttributeListImpl
01641      */
01642     AttributeListImpl                   m_dummyAttributesList;
01643 
01644     XalanDOMString                      m_scratchString;
01645 
01646     XalanDOMStringPointerVectorType     m_attributeNamesVisited;
01647 
01648     bool                                m_hasCDATASectionElements;
01649 
01650     XPathConstructionContextDefault     m_xpathConstructionContext;
01651 
01652     static void
01653     installFunctions(MemoryManagerType& theManager);
01654 
01655     static void
01656     uninstallFunctions();
01657 
01658 
01659     static const XalanDOMString     s_emptyString;
01660 
01661     static const XalanDOMString&    s_stylesheetNodeName;
01662     static const XalanDOMString&    s_typeString;
01663     static const XalanDOMString&    s_hrefString;
01664     static const XalanDOMString&    s_piTokenizerString;
01665     static const XalanDOMString&    s_typeValueString1;
01666     static const XalanDOMString&    s_typeValueString2;
01667     static const XalanDOMString&    s_typeValueString3;
01668     static const XalanDOMString&    s_typeValueString4;
01669 
01670     // Not implemented...
01671     XSLTEngineImpl(const XSLTEngineImpl&);
01672 
01673     XSLTEngineImpl&
01674     operator=(const XSLTEngineImpl&);
01675 
01676     bool
01677     operator==(const XSLTEngineImpl&) const;
01678 };
01679 
01680 
01681 
01682 XALAN_CPP_NAMESPACE_END
01683 
01684 
01685 
01686 #endif  // XALAN_XSLTENGINEIMPL_HEADER_GUARD

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