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 00036 00037 00038 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00039 00040 00041 00042 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION) 00043 #include <xalanc/XPath/XPathProcessor.hpp> 00044 #endif 00045 00046 00047 00048 #include <xalanc/Include/XalanMemMgrAutoPtr.hpp> 00049 #include <xalanc/Include/XalanMap.hpp> 00050 00051 00052 00053 #include <xalanc/PlatformSupport/AttributeListImpl.hpp> 00054 #include <xalanc/PlatformSupport/DOMStringHelper.hpp> 00055 #include <xalanc/PlatformSupport/PrefixResolver.hpp> 00056 00057 00058 00059 #include <xalanc/DOMSupport/XalanNamespacesStack.hpp> 00060 00061 00062 00063 #include <xalanc/XPath/Function.hpp> 00064 00065 00066 00067 #include <xalanc/XPath/XPathConstructionContextDefault.hpp> 00068 00069 00070 00071 #include "OutputContextStack.hpp" 00072 #include "ProblemListenerDefault.hpp" 00073 #include "ResultNamespacesStack.hpp" 00074 #include "StylesheetExecutionContext.hpp" 00075 #include "XSLTProcessorException.hpp" 00076 00077 00078 00079 XALAN_DECLARE_XERCES_CLASS(InputSource) 00080 XALAN_DECLARE_XERCES_CLASS(DocumentHandler) 00081 00082 00083 00084 XALAN_CPP_NAMESPACE_BEGIN 00085 00086 00087 00088 typedef XERCES_CPP_NAMESPACE_QUALIFIER InputSource InputSourceType; 00089 typedef XERCES_CPP_NAMESPACE_QUALIFIER DocumentHandler DocumentHandlerType; 00090 00091 00092 00093 // Forward declarations... 00094 class DOMSupport; 00095 class GenerateEvent; 00096 class PrintWriter; 00097 class StylesheetConstructionContext; 00098 class StylesheetRoot; 00099 class XalanAttr; 00100 class XalanSourceTreeDocument; 00101 class XalanText; 00102 class XMLParserLiaison; 00103 class XObject; 00104 class XPathEnvSupport; 00105 class XPathFactory; 00106 class XPathProcessor; 00107 class XSLTResultTarget; 00108 00109 00110 00123 class XALAN_XSLT_EXPORT XSLTEngineImpl : public XSLTProcessor, public PrefixResolver 00124 { 00125 public: 00126 00127 #if defined(XALAN_STRICT_ANSI_HEADERS) 00128 typedef std::clock_t ClockType; 00129 #else 00130 typedef clock_t ClockType; 00131 #endif 00132 00133 struct LessXalanDOMStringPointers 00134 { 00135 bool 00136 operator()( 00137 const XalanDOMString* theLHS, 00138 const XalanDOMString* theRHS) const 00139 { 00140 if (theLHS == 0 && theRHS != 0) 00141 { 00142 return true; 00143 } 00144 else if (theRHS == 0) 00145 { 00146 return false; 00147 } 00148 else 00149 { 00150 return theLHS->compare(*theRHS) < 0 ? true : false; 00151 } 00152 } 00153 }; 00154 00155 typedef XalanVector<const LocatorType*> LocatorStack; 00156 typedef XalanVector<TraceListener*> TraceListenerVectorType; 00157 typedef XalanVector<const XalanDOMString*> XalanDOMStringPointerVectorType; 00158 00159 typedef XalanMap<const void*, ClockType> DurationsTableMapType; 00160 00161 typedef XalanVector<bool> BoolVectorType; 00162 00163 struct FindStringPointerFunctor 00164 { 00165 FindStringPointerFunctor(const XalanDOMString& theString) : 00166 m_string(theString) 00167 { 00168 } 00169 00170 bool 00171 operator()(const XalanDOMString* theString) const 00172 { 00173 assert(theString != 0); 00174 00175 return *theString == m_string; 00176 } 00177 00178 private: 00179 00180 const XalanDOMString& m_string; 00181 }; 00182 00183 typedef XalanMemMgrAutoPtr<XPathProcessor, true> XPathProcessorPtrType; 00184 typedef Function::XObjectArgVectorType XObjectArgVectorType; 00185 typedef StylesheetExecutionContext::ParamVectorType ParamVectorType; 00186 typedef XPathConstructionContext::GetAndReleaseCachedString CCGetAndReleaseCachedString; 00187 typedef XPathExecutionContext::GetAndReleaseCachedString ECGetAndReleaseCachedString; 00188 00189 // Public members 00190 //--------------------------------------------------------------------- 00191 00204 XSLTEngineImpl( 00205 MemoryManagerType& theManager, 00206 XMLParserLiaison& parserLiaison, 00207 XPathEnvSupport& xpathEnvSupport, 00208 DOMSupport& domSupport, 00209 XObjectFactory& xobjectFactory, 00210 XPathFactory& xpathFactory); 00211 00212 virtual 00213 ~XSLTEngineImpl(); 00214 00215 MemoryManagerType& 00216 getMemoryManager() 00217 { 00218 return m_xpathConstructionContext.getMemoryManager(); 00219 } 00220 00225 static void 00226 initialize(MemoryManagerType& theManager); 00227 00231 static void 00232 terminate(); 00233 00234 // These methods are inherited from XSLTProcessor ... 00235 00236 virtual void 00237 process( 00238 const XSLTInputSource& inputSource, 00239 const XSLTInputSource& stylesheetSource, 00240 XSLTResultTarget& outputTarget, 00241 StylesheetConstructionContext& constructionContext, 00242 StylesheetExecutionContext& executionContext); 00243 00244 virtual void 00245 process( 00246 const XSLTInputSource& inputSource, 00247 XSLTResultTarget& outputTarget, 00248 StylesheetExecutionContext& executionContext); 00249 00250 virtual StylesheetRoot* 00251 processStylesheet( 00252 const XSLTInputSource& stylesheetSource, 00253 StylesheetConstructionContext& constructionContext); 00254 00255 virtual StylesheetRoot* 00256 processStylesheet( 00257 const XalanDOMString& xsldocURLString, 00258 StylesheetConstructionContext& constructionContext); 00259 00260 virtual XalanNode* 00261 getSourceTreeFromInput(const XSLTInputSource& inputSource); 00262 00263 virtual void 00264 resolveTopLevelParams(StylesheetExecutionContext& executionContext); 00265 00266 virtual XMLParserLiaison& 00267 getXMLParserLiaison() const; 00268 00269 virtual void 00270 getUniqueNamespaceValue(XalanDOMString& theValue); 00271 00272 virtual void 00273 setStylesheetParam( 00274 const XalanDOMString& key, 00275 const XalanDOMString& expression); 00276 00277 virtual void 00278 setStylesheetParam( 00279 const XalanDOMString& key, 00280 XObjectPtr value); 00281 00282 virtual FormatterListener* 00283 getFormatterListener() const; 00284 00285 virtual void 00286 setFormatterListener(FormatterListener* flistener); 00287 00288 // Trace-related functions... 00289 00290 virtual size_type 00291 getTraceListeners() const; 00292 00293 virtual void 00294 addTraceListener(TraceListener* tl); 00295 00296 virtual void 00297 removeTraceListener(TraceListener* tl); 00298 00299 virtual void 00300 fireGenerateEvent(const GenerateEvent& ge); 00301 00302 virtual void 00303 fireTraceEvent(const TracerEvent& te); 00304 00305 virtual void 00306 fireSelectEvent(const SelectionEvent& se); 00307 00308 virtual bool 00309 getTraceSelects() const; 00310 00311 virtual void 00312 setTraceSelects(bool b); 00313 00314 void 00315 traceSelect( 00316 StylesheetExecutionContext& executionContext, 00317 const ElemTemplateElement& theTemplate, 00318 const NodeRefListBase& nl, 00319 const XPath* xpath) const; 00320 00321 virtual void 00322 setQuietConflictWarnings(bool b); 00323 00324 virtual void 00325 setDiagnosticsOutput(PrintWriter* pw); 00326 00327 00328 // Inherited from PrefixResolver... 00329 00338 virtual const XalanDOMString* 00339 getNamespaceForPrefix(const XalanDOMString& prefix) const; 00340 00346 virtual const XalanDOMString& 00347 getURI() const; 00348 00360 XalanDocument* 00361 parseXML( 00362 const XalanDOMString& urlString, 00363 DocumentHandlerType* docHandler, 00364 XalanDocument* docToRegister); 00365 00377 XalanDocument* 00378 parseXML( 00379 const InputSourceType& inputSource, 00380 DocumentHandlerType* docHandler, 00381 XalanDocument* docToRegister); 00382 00395 Stylesheet* 00396 getStylesheetFromPIURL( 00397 const XalanDOMString& xslURLString, 00398 XalanNode& fragBase, 00399 const XalanDOMString& xmlBaseIdent, 00400 bool isRoot, 00401 StylesheetConstructionContext& constructionContext); 00402 00406 void 00407 flushPending(); 00408 00415 void 00416 addResultNamespaceDecl( 00417 const XalanDOMString& prefix, 00418 const XalanDOMString& namespaceVal) 00419 { 00420 addResultNamespaceDecl( 00421 prefix, 00422 namespaceVal.c_str(), 00423 namespaceVal.length()); 00424 } 00425 00433 void 00434 addResultNamespaceDecl( 00435 const XalanDOMString& prefix, 00436 const XalanDOMChar* namespaceVal, 00437 XalanDOMString::size_type len) 00438 { 00439 m_resultNamespacesStack.addDeclaration( 00440 prefix, 00441 namespaceVal, 00442 len); 00443 } 00444 00453 void 00454 addResultAttribute( 00455 AttributeListImpl& attList, 00456 const XalanDOMString& aname, 00457 const XalanDOMString& value) 00458 { 00459 addResultAttribute( 00460 attList, 00461 aname, 00462 value.c_str()); 00463 } 00464 00473 void 00474 addResultAttribute( 00475 AttributeListImpl& attList, 00476 const XalanDOMString& aname, 00477 const XalanDOMChar* value); 00478 00486 void 00487 addResultAttribute( 00488 const XalanDOMString& aname, 00489 const XalanDOMChar* value) 00490 { 00491 assert(m_outputContextStack.empty() == false); 00492 00493 addResultAttribute( 00494 getPendingAttributesImpl(), 00495 aname, 00496 value); 00497 } 00498 00506 void 00507 addResultAttribute( 00508 const XalanDOMString& aname, 00509 const XalanDOMString& value) 00510 { 00511 assert(m_outputContextStack.empty() == false); 00512 00513 addResultAttribute( 00514 getPendingAttributesImpl(), 00515 aname, 00516 value); 00517 } 00518 00519 void 00520 setDocumentLocator(const LocatorType* locator); 00521 00522 void 00523 startDocument(); 00524 00525 void 00526 endDocument(); 00527 00528 void 00529 startElement( 00530 const XalanDOMChar* name, 00531 AttributeListType& atts); 00532 00533 void 00534 endElement(const XalanDOMChar* name); 00535 00536 void 00537 characters ( 00538 const XalanDOMChar* ch, 00539 XalanDOMString::size_type length); 00540 00541 void 00542 ignorableWhitespace( 00543 const XalanDOMChar* ch, 00544 XalanDOMString::size_type length); 00545 00546 void 00547 processingInstruction( 00548 const XalanDOMChar* target, 00549 const XalanDOMChar* data); 00550 00551 void 00552 resetDocument(); 00553 00561 void 00562 characters( 00563 const XalanDOMChar* ch, 00564 XalanDOMString::size_type start, 00565 XalanDOMString::size_type length); 00566 00572 void 00573 characters(const XalanNode& node); 00574 00580 void 00581 characters(const XObjectPtr& xobject); 00582 00589 void 00590 startElement(const XalanDOMChar* name); 00591 00601 void 00602 charactersRaw( 00603 const XalanDOMChar* ch, 00604 XalanDOMString::size_type start, 00605 XalanDOMString::size_type length); 00606 00612 void 00613 charactersRaw(const XalanNode& node); 00614 00620 void 00621 charactersRaw(const XObjectPtr& xobject); 00622 00628 void 00629 comment(const XalanDOMChar* data); 00630 00637 void 00638 entityReference(const XalanDOMChar* data); 00639 00647 void 00648 cdata( 00649 const XalanDOMChar* ch, 00650 XalanDOMString::size_type start, 00651 XalanDOMString::size_type length); 00652 00660 void 00661 cloneToResultTree( 00662 const XalanNode& node, 00663 bool cloneTextNodesOnly, 00664 const LocatorType* locator); 00665 00676 void 00677 cloneToResultTree( 00678 const XalanNode& node, 00679 XalanNode::NodeType nodeType, 00680 bool overrideStrip, 00681 bool shouldCloneAttributes, 00682 bool cloneTextNodesOnly, 00683 const LocatorType* locator); 00684 00692 void 00693 outputToResultTree( 00694 const XObject& value, 00695 bool outputTextNodesOnly, 00696 const LocatorType* locator); 00697 00706 void 00707 outputResultTreeFragment( 00708 const XObject& theTree, 00709 bool outputTextNodesOnly, 00710 const LocatorType* locator) 00711 { 00712 outputResultTreeFragment(theTree.rtree(), outputTextNodesOnly, locator); 00713 } 00714 00723 void 00724 outputResultTreeFragment( 00725 const XalanDocumentFragment& theTree, 00726 bool outputTextNodesOnly, 00727 const LocatorType* locator); 00728 00734 virtual const StylesheetRoot* 00735 getStylesheetRoot() const; 00736 00742 virtual void 00743 setStylesheetRoot(const StylesheetRoot* theStylesheet); 00744 00750 virtual void 00751 setExecutionContext(StylesheetExecutionContext* theExecutionContext); 00752 00759 static const XalanDOMString& 00760 getXSLNameSpaceURL() 00761 { 00762 return s_XSLNameSpaceURL; 00763 } 00764 00770 static const XalanDOMString& 00771 getXalanXSLNameSpaceURL() 00772 { 00773 return s_XalanNamespaceURL; 00774 } 00775 00781 bool 00782 getQuietConflictWarnings() const 00783 { 00784 return m_quietConflictWarnings; 00785 } 00786 00787 virtual void 00788 message( 00789 const XalanDOMString& msg, 00790 const XalanNode* sourceNode = 0, 00791 const ElemTemplateElement* styleNode = 0) const; 00792 00793 virtual void 00794 message( 00795 const XalanDOMString& msg, 00796 const LocatorType& locator, 00797 const XalanNode* sourceNode = 0) const; 00798 00799 virtual void 00800 warn( 00801 const XalanDOMString& msg, 00802 const XalanNode* sourceNode = 0, 00803 const ElemTemplateElement* styleNode = 0) const; 00804 00805 00806 virtual void 00807 warn( 00808 const XalanDOMString& msg, 00809 const LocatorType& locator, 00810 const XalanNode* sourceNode = 0) const; 00811 00812 virtual void 00813 error( 00814 const XalanDOMString& msg, 00815 const XalanNode* sourceNode = 0, 00816 const ElemTemplateElement* styleNode = 0) const; 00817 00818 virtual void 00819 error( 00820 const XalanDOMString& msg, 00821 const LocatorType& locator, 00822 const XalanNode* sourceNode = 0) const; 00823 00824 public: 00825 00832 void 00833 pushTime(const void* key); 00834 00841 ClockType 00842 popDuration(const void* key); 00843 00851 void 00852 displayDuration( 00853 const XalanDOMString& info, 00854 const void* key); 00855 00856 00862 bool doDiagnosticsOutput() 00863 { 00864 return 0 != m_diagnosticsPrintWriter ? true : false; 00865 } 00866 00872 void 00873 diag(const XalanDOMString& s) const; 00874 00880 void 00881 diag(const char* s) const; 00882 00889 const XalanDOMString* 00890 getResultNamespaceForPrefix(const XalanDOMString& prefix) const; 00891 00898 const XalanDOMString* 00899 getResultPrefixForNamespace(const XalanDOMString& theNamespace) const; 00900 00909 bool 00910 isPendingResultPrefix(const XalanDOMString& thePrefix) const; 00911 00920 double 00921 evalMatchPatternStr( 00922 const XalanDOMString& str, 00923 XalanNode* context, 00924 XPathExecutionContext& executionContext); 00925 00933 const XPath* 00934 createMatchPattern( 00935 const XalanDOMString& str, 00936 const PrefixResolver& resolver); 00937 00944 void 00945 returnXPath(const XPath* xpath); 00946 00952 void 00953 copyNamespaceAttributes(const XalanNode& src); 00954 00962 const XObjectPtr 00963 evalXPathStr( 00964 const XalanDOMString& str, 00965 XPathExecutionContext& executionContext); 00966 00976 const XObjectPtr 00977 evalXPathStr( 00978 const XalanDOMString& str, 00979 XalanNode* contextNode, 00980 const PrefixResolver& prefixResolver, 00981 XPathExecutionContext& executionContext); 00982 00992 const XObjectPtr 00993 evalXPathStr( 00994 const XalanDOMString& str, 00995 XalanNode* contextNode, 00996 const XalanElement& prefixResolver, 00997 XPathExecutionContext& executionContext); 00998 01006 void 01007 copyAttributeToTarget( 01008 const XalanDOMString& attrName, 01009 const XalanDOMString& attrValue, 01010 AttributeListImpl& attrList); 01011 01017 XPathFactory& 01018 getXPathFactory() 01019 { 01020 return m_xpathFactory; 01021 } 01022 01028 XPathProcessor& 01029 getXPathProcessor() 01030 { 01031 return *m_xpathProcessor.get(); 01032 } 01033 01038 virtual void 01039 reset(); 01040 01046 XPathEnvSupport& 01047 getXPathEnvSupport() 01048 { 01049 return m_xpathEnvSupport; 01050 } 01051 01060 void 01061 setProblemListener(ProblemListener* l) 01062 { 01063 m_problemListener = l; 01064 } 01065 01074 ProblemListener* 01075 getProblemListener() const 01076 { 01077 return m_problemListener; 01078 } 01079 01080 /* 01081 * Push a new output context using the provided FormatterListener. 01082 * 01083 * @param A pointer to the FormatterListener instance for the new context. 01084 */ 01085 void 01086 pushOutputContext(FormatterListener* theListener) 01087 { 01088 m_outputContextStack.pushContext(theListener); 01089 } 01090 01091 /* 01092 * Pop the current output context. 01093 */ 01094 void 01095 popOutputContext() 01096 { 01097 m_outputContextStack.popContext(); 01098 } 01099 01100 /* 01101 * See if there is a pending start document event waiting. 01102 * @return true if there is a start document event waiting. 01103 */ 01104 bool 01105 getHasPendingStartDocument() const 01106 { 01107 return getHasPendingStartDocumentImpl(); 01108 } 01109 01110 /* 01111 * Set the pending start document event state. 01112 * @param the new value 01113 */ 01114 void 01115 setHasPendingStartDocument(bool b) 01116 { 01117 setHasPendingStartDocumentImpl(b); 01118 } 01119 01120 /* 01121 * See if a pending start document event must be flushed. 01122 * @return true if the event must be flushed. 01123 */ 01124 bool 01125 getMustFlushPendingStartDocument() const 01126 { 01127 return getMustFlushPendingStartDocumentImpl(); 01128 } 01129 01130 /* 01131 * Set the pending start document event flush state. 01132 * @param the new value 01133 */ 01134 void 01135 setMustFlushPendingStartDocument(bool b) 01136 { 01137 setMustFlushPendingStartDocumentImpl(b); 01138 } 01139 01145 const AttributeListType& 01146 getPendingAttributes() const 01147 { 01148 return getPendingAttributesImpl(); 01149 } 01150 01156 void 01157 setPendingAttributes(const AttributeListType& pendingAttributes) 01158 { 01159 getPendingAttributesImpl() = pendingAttributes; 01160 } 01161 01169 void 01170 replacePendingAttribute( 01171 const XalanDOMChar* theName, 01172 const XalanDOMChar* theNewType, 01173 const XalanDOMChar* theNewValue) 01174 { 01175 // Remove the old attribute, then add the new one. AttributeListImpl::addAttribute() 01176 // does this for us. 01177 getPendingAttributesImpl().addAttribute(theName, theNewType, theNewValue); 01178 } 01179 01180 bool 01181 isElementPending() const 01182 { 01183 return length(getPendingElementNameImpl()) != 0 ? true : false; 01184 } 01185 01191 const XalanDOMString& 01192 getPendingElementName() const 01193 { 01194 return getPendingElementNameImpl(); 01195 } 01196 01202 void 01203 setPendingElementName(const XalanDOMString& elementName) 01204 { 01205 setPendingElementNameImpl(elementName); 01206 } 01207 01208 void 01209 setPendingElementName(const XalanDOMChar* elementName) 01210 { 01211 setPendingElementNameImpl(elementName); 01212 } 01213 01219 const LocatorType* 01220 getLocatorFromStack() const 01221 { 01222 return m_stylesheetLocatorStack.empty() == true ? 0 : m_stylesheetLocatorStack.back(); 01223 } 01224 01230 void 01231 pushLocatorOnStack(const LocatorType* locator) 01232 { 01233 m_stylesheetLocatorStack.push_back(locator); 01234 } 01235 01239 void 01240 popLocatorStack() 01241 { 01242 if (m_stylesheetLocatorStack.empty() == false) 01243 { 01244 m_stylesheetLocatorStack.pop_back(); 01245 } 01246 } 01247 01248 protected: 01249 01255 const AttributeListImpl& 01256 getPendingAttributesImpl() const 01257 { 01258 return m_outputContextStack.getPendingAttributes(); 01259 } 01260 01266 AttributeListImpl& 01267 getPendingAttributesImpl() 01268 { 01269 return m_outputContextStack.getPendingAttributes(); 01270 } 01271 01277 void 01278 setPendingAttributesImpl(const AttributeListType& pendingAttributes) 01279 { 01280 getPendingAttributesImpl() = pendingAttributes; 01281 } 01282 01288 const XalanDOMString& 01289 getPendingElementNameImpl() const 01290 { 01291 return m_outputContextStack.getPendingElementName(); 01292 } 01293 01299 XalanDOMString& 01300 getPendingElementNameImpl() 01301 { 01302 return m_outputContextStack.getPendingElementName(); 01303 } 01304 01310 void 01311 setPendingElementNameImpl(const XalanDOMString& elementName) 01312 { 01313 m_outputContextStack.getPendingElementName() = elementName; 01314 } 01315 01321 void 01322 setPendingElementNameImpl(const XalanDOMChar* elementName) 01323 { 01324 assert(elementName != 0); 01325 01326 m_outputContextStack.getPendingElementName() = elementName; 01327 } 01328 01329 /* 01330 * See if there is a pending start document event waiting. 01331 * @return true if there is a start document event waiting. 01332 */ 01333 bool 01334 getHasPendingStartDocumentImpl() const 01335 { 01336 return m_outputContextStack.getHasPendingStartDocument(); 01337 } 01338 01339 /* 01340 * Set the pending start document event state. 01341 * @param the new value 01342 */ 01343 void 01344 setHasPendingStartDocumentImpl(bool b) 01345 { 01346 m_outputContextStack.getHasPendingStartDocument() = b; 01347 } 01348 01349 /* 01350 * See if a pending start document event must be flushed. 01351 * @return true if the event must be flushed. 01352 */ 01353 bool 01354 getMustFlushPendingStartDocumentImpl() const 01355 { 01356 return m_outputContextStack.getMustFlushPendingStartDocument(); 01357 } 01358 01359 /* 01360 * Set the pending start document event flush state. 01361 * @param the new value 01362 */ 01363 void 01364 setMustFlushPendingStartDocumentImpl(bool b) 01365 { 01366 m_outputContextStack.getMustFlushPendingStartDocument() = b; 01367 } 01368 01369 FormatterListener* 01370 getFormatterListenerImpl() const 01371 { 01372 return m_outputContextStack.getFormatterListener(); 01373 } 01374 01375 void 01376 setFormatterListenerImpl(FormatterListener* flistener) 01377 { 01378 m_outputContextStack.getFormatterListener() = flistener; 01379 } 01380 01387 XalanDOMString m_resultNameSpacePrefix; 01388 01392 XalanDOMString m_resultNameSpaceURL; 01393 01394 01399 void 01400 copyAttributesToAttList( 01401 const XalanNode& node, 01402 AttributeListImpl& attList); 01403 01404 // Factory for creating xpaths. 01405 XPathFactory& m_xpathFactory; 01406 01407 // Factory for creating xobjects 01408 XObjectFactory& m_xobjectFactory; 01409 01410 // The query/pattern-matcher object. 01411 const XPathProcessorPtrType m_xpathProcessor; 01412 01417 BoolVectorType m_cdataStack; 01418 01419 private: 01420 01427 void 01428 warnCopyTextNodesOnly( 01429 const XalanNode* sourceNode, 01430 const LocatorType* locator); 01431 01438 void 01439 cloneToResultTree( 01440 const XalanText& node, 01441 bool overrideStrip); 01442 01447 bool 01448 pendingAttributesHasDefaultNS() const; 01449 01450 void 01451 addResultNamespace( 01452 const XalanDOMString& thePrefix, 01453 const XalanDOMString& theName, 01454 const XalanNode& theNode, 01455 AttributeListImpl& thePendingAttributes, 01456 bool fOnlyIfPrefixNotPresent); 01457 01458 void 01459 addResultNamespace( 01460 const XalanNode& theNode, 01461 AttributeListImpl& thePendingAttributes, 01462 bool fOnlyIfPrefixNotPresent = false); 01463 01468 LocatorStack m_stylesheetLocatorStack; 01469 01476 ProblemListenerDefault m_defaultProblemListener; 01477 01478 ProblemListener* m_problemListener; 01479 01483 const StylesheetRoot* m_stylesheetRoot; 01484 01488 static const XalanDOMString& s_XSLNameSpaceURL; //"http://www.w3.org/1999/XSL/Transform" 01489 01493 static const XalanDOMString& s_XalanNamespaceURL; // "http://xml.apache.org/xalan" 01494 01498 static const XalanDOMString& s_uniqueNamespacePrefix; 01499 01503 bool m_traceSelects; 01504 01509 bool m_quietConflictWarnings; 01510 01511 /* 01512 * A stream to print diagnostics to. 01513 */ 01514 PrintWriter* m_diagnosticsPrintWriter; 01515 01516 /* For diagnostics */ 01517 DurationsTableMapType m_durationsTable; 01518 01523 TraceListenerVectorType m_traceListeners; 01524 01525 void 01526 problem( 01527 const XalanDOMString& msg, 01528 ProblemListener::eClassification classification, 01529 const XalanNode* sourceNode, 01530 const ElemTemplateElement* styleNode) const; 01531 01532 void 01533 problem( 01534 const XalanDOMString& msg, 01535 ProblemListener::eClassification classification, 01536 const LocatorType& locator, 01537 const XalanNode* sourceNode) const; 01538 01539 //========================================================== 01540 // SECTION: Function to do with attribute handling 01541 //========================================================== 01542 01546 unsigned long m_uniqueNSValue; 01547 01548 ParamVectorType m_topLevelParams; 01549 01550 public: 01551 01555 void 01556 clearTopLevelParams() 01557 { 01558 m_topLevelParams.clear(); 01559 } 01560 01561 private: 01562 01563 bool 01564 generateCDATASection() const 01565 { 01566 if (m_hasCDATASectionElements == false) 01567 { 01568 return false; 01569 } 01570 else 01571 { 01572 assert(m_cdataStack.empty() == false); 01573 01574 return m_cdataStack.back(); 01575 } 01576 } 01577 01578 void 01579 doFlushPending() 01580 { 01581 setMustFlushPendingStartDocument(true); 01582 01583 flushPending(); 01584 } 01585 01593 bool 01594 isCDataResultElem(const XalanDOMString& elementName) const; 01595 01596 void 01597 fireCharacterGenerateEvent( 01598 const XalanNode& theNode, 01599 bool isCDATA); 01600 01601 void 01602 fireCharacterGenerateEvent( 01603 const XObjectPtr& theXObject, 01604 bool isCDATA); 01605 01606 void 01607 fireCharacterGenerateEvent( 01608 const XalanDOMString& theString, 01609 bool isCDATA); 01610 01611 void 01612 fireCharacterGenerateEvent( 01613 const XalanDOMChar* ch, 01614 XalanDOMString::size_type start, 01615 XalanDOMString::size_type length, 01616 bool isCDATA); 01617 01618 void 01619 checkDefaultNamespace( 01620 const XalanDOMString& theElementName, 01621 const XalanDOMString& theElementNamespaceURI); 01622 01623 01624 01625 // Data members... 01626 XMLParserLiaison& m_parserLiaison; 01627 01628 XPathEnvSupport& m_xpathEnvSupport; 01629 01630 DOMSupport& m_domSupport; 01631 01635 StylesheetExecutionContext* m_executionContext; 01636 01637 /* 01638 * Stack of current output contexts... 01639 */ 01640 OutputContextStack m_outputContextStack; 01641 01642 /* 01643 * Stack of current result namespaces... 01644 */ 01645 XalanNamespacesStack m_resultNamespacesStack; 01646 01647 /* 01648 * Dummy AttributeListImpl 01649 */ 01650 AttributeListImpl m_dummyAttributesList; 01651 01652 XalanDOMString m_scratchString; 01653 01654 XalanDOMStringPointerVectorType m_attributeNamesVisited; 01655 01656 bool m_hasCDATASectionElements; 01657 01658 XPathConstructionContextDefault m_xpathConstructionContext; 01659 01660 static void 01661 installFunctions(MemoryManagerType& theManager); 01662 01663 static void 01664 uninstallFunctions(); 01665 01666 01667 static const XalanDOMString s_emptyString; 01668 01669 static const XalanDOMString& s_stylesheetNodeName; 01670 static const XalanDOMString& s_typeString; 01671 static const XalanDOMString& s_hrefString; 01672 static const XalanDOMString& s_piTokenizerString; 01673 static const XalanDOMString& s_typeValueString1; 01674 static const XalanDOMString& s_typeValueString2; 01675 static const XalanDOMString& s_typeValueString3; 01676 static const XalanDOMString& s_typeValueString4; 01677 01678 // Not implemented... 01679 XSLTEngineImpl(const XSLTEngineImpl&); 01680 01681 XSLTEngineImpl& 01682 operator=(const XSLTEngineImpl&); 01683 01684 bool 01685 operator==(const XSLTEngineImpl&) const; 01686 }; 01687 01688 01689 01690 XALAN_CPP_NAMESPACE_END 01691 01692 01693 01694 #endif // XALAN_XSLTENGINEIMPL_HEADER_GUARD
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.9 |
|