00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999-2001 The Apache Software Foundation. All rights 00006 * reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * 1. Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in 00017 * the documentation and/or other materials provided with the 00018 * distribution. 00019 * 00020 * 3. The end-user documentation included with the redistribution, 00021 * if any, must include the following acknowledgment: 00022 * "This product includes software developed by the 00023 * Apache Software Foundation (http://www.apache.org/)." 00024 * Alternately, this acknowledgment may appear in the software itself, 00025 * if and wherever such third-party acknowledgments normally appear. 00026 * 00027 * 4. The names "Xalan" and "Apache Software Foundation" must 00028 * not be used to endorse or promote products derived from this 00029 * software without prior written permission. For written 00030 * permission, please contact apache@apache.org. 00031 * 00032 * 5. Products derived from this software may not be called "Apache", 00033 * nor may "Apache" appear in their name, without prior written 00034 * permission of the Apache Software Foundation. 00035 * 00036 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00037 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00038 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00039 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00040 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00041 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00042 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00043 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00044 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00045 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00046 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00047 * SUCH DAMAGE. 00048 * ==================================================================== 00049 * 00050 * This software consists of voluntary contributions made by many 00051 * individuals on behalf of the Apache Software Foundation and was 00052 * originally based on software copyright (c) 1999, International 00053 * Business Machines, Inc., http://www.ibm.com. For more 00054 * information on the Apache Software Foundation, please see 00055 * <http://www.apache.org/>. 00056 */ 00057 #if !defined(XALAN_XSLTENGINEIMPL_HEADER_GUARD) 00058 #define XALAN_XSLTENGINEIMPL_HEADER_GUARD 00059 00060 00061 00062 // Base include file. Must be first. 00063 #include "XSLTDefinitions.hpp" 00064 00065 00066 00067 // Base class 00068 #include "XSLTProcessor.hpp" 00069 00070 00071 00072 00073 // Standard library headers 00074 #include <cassert> 00075 #include <ctime> 00076 #include <map> 00077 #include <set> 00078 00079 00080 00081 #include <sax/DocumentHandler.hpp> 00082 00083 00084 00085 #include <XalanDOM/XalanDOMString.hpp> 00086 00087 00088 00089 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION) 00090 #include <XPath/XPathProcessor.hpp> 00091 #endif 00092 00093 00094 00095 #include <Include/XalanAutoPtr.hpp> 00096 00097 00098 00099 #include <PlatformSupport/AttributeListImpl.hpp> 00100 #include <PlatformSupport/DOMStringHelper.hpp> 00101 #include <PlatformSupport/PrefixResolver.hpp> 00102 00103 00104 00105 #include <XPath/Function.hpp> 00106 #include <XPath/NameSpace.hpp> 00107 00108 00109 00110 #include "KeyDeclaration.hpp" 00111 #include "OutputContextStack.hpp" 00112 #include "ProblemListenerDefault.hpp" 00113 #include "ResultNamespacesStack.hpp" 00114 #include "StylesheetExecutionContext.hpp" 00115 #include "XSLTProcessorException.hpp" 00116 00117 00118 00119 // Forward declarations... 00120 class DOMSupport; 00121 class GenerateEvent; 00122 class InputSource; 00123 class PrintWriter; 00124 class ResultTreeFragBase; 00125 class StylesheetConstructionContext; 00126 class StylesheetExecutionContext; 00127 class StylesheetRoot; 00128 class XalanAttr; 00129 class XalanSourceTreeDocument; 00130 class XalanText; 00131 class XLocator; 00132 class XMLParserLiaison; 00133 class XMLURL; 00134 class XObject; 00135 class XPathEnvSupport; 00136 class XPathFactory; 00137 class XPathProcessor; 00138 class XSLTResultTarget; 00139 00140 00141 00153 00154 class XALAN_XSLT_EXPORT XSLTEngineImpl : public XSLTProcessor, public PrefixResolver 00155 { 00156 public: 00157 00158 #if defined(XALAN_NO_NAMESPACES) 00159 typedef map<XalanDOMString, 00160 int, 00161 less<XalanDOMString> > AttributeKeysMapType; 00162 typedef map<XalanDOMString, 00163 int, 00164 less<XalanDOMString> > ElementKeysMapType; 00165 typedef map<const void*, 00166 clock_t, 00167 less<const void*> > DurationsTableMapType; 00168 typedef vector<const Locator*> LocatorStack; 00169 typedef vector<TraceListener*> TraceListenerVectorType; 00170 typedef vector<bool> BoolVectorType; 00171 #else 00172 typedef std::map<XalanDOMString, int> AttributeKeysMapType; 00173 typedef std::map<XalanDOMString, int> ElementKeysMapType; 00174 typedef std::map<const void*, clock_t> DurationsTableMapType; 00175 typedef std::vector<const Locator*> LocatorStack; 00176 typedef std::vector<TraceListener*> TraceListenerVectorType; 00177 typedef std::vector<bool> BoolVectorType; 00178 #endif 00179 00180 typedef XalanAutoPtr<XPathProcessor> XPathProcessorPtrType; 00181 typedef Function::XObjectArgVectorType XObjectArgVectorType; 00182 typedef StylesheetExecutionContext::ParamVectorType ParamVectorType; 00183 00184 // Public members 00185 //--------------------------------------------------------------------- 00186 00199 XSLTEngineImpl( 00200 XMLParserLiaison& parserLiaison, 00201 XPathEnvSupport& xpathEnvSupport, 00202 DOMSupport& domSupport, 00203 XObjectFactory& xobjectFactory, 00204 XPathFactory& xpathFactory); 00205 00206 virtual 00207 ~XSLTEngineImpl(); 00208 00213 static void 00214 initialize(); 00215 00219 static void 00220 terminate(); 00221 00222 // These methods are inherited from XSLTProcessor ... 00223 00224 virtual void 00225 process( 00226 const XSLTInputSource& inputSource, 00227 const XSLTInputSource& stylesheetSource, 00228 XSLTResultTarget& outputTarget, 00229 StylesheetConstructionContext& constructionContext, 00230 StylesheetExecutionContext& executionContext); 00231 00232 virtual void 00233 process( 00234 const XSLTInputSource& inputSource, 00235 XSLTResultTarget& outputTarget, 00236 StylesheetExecutionContext& executionContext); 00237 00238 virtual StylesheetRoot* 00239 processStylesheet( 00240 const XSLTInputSource& stylesheetSource, 00241 StylesheetConstructionContext& constructionContext); 00242 00243 virtual StylesheetRoot* 00244 processStylesheet( 00245 const XalanDOMString& xsldocURLString, 00246 StylesheetConstructionContext& constructionContext); 00247 00248 virtual XalanNode* 00249 getSourceTreeFromInput(const XSLTInputSource& inputSource); 00250 00251 virtual void 00252 outputToResultTree(const XObject& xobj); 00253 00254 virtual void 00255 resolveTopLevelParams(StylesheetExecutionContext& executionContext); 00256 00257 virtual XMLParserLiaison& 00258 getXMLParserLiaison() const; 00259 00260 virtual const XalanDOMString 00261 getUniqueNamespaceValue(); 00262 00263 virtual void 00264 getUniqueNamespaceValue(XalanDOMString& theValue); 00265 00266 virtual void 00267 setStylesheetParam( 00268 const XalanDOMString& key, 00269 const XalanDOMString& expression); 00270 00271 virtual void 00272 setStylesheetParam( 00273 const XalanDOMString& key, 00274 XObjectPtr value); 00275 00276 virtual bool 00277 shouldStripSourceNode( 00278 XPathExecutionContext& executionContext, 00279 const XalanNode& node) const; 00280 00281 virtual FormatterListener* 00282 getFormatterListener() const; 00283 00284 virtual void 00285 setFormatterListener(FormatterListener* flistener); 00286 00287 // Trace-related functions... 00288 00289 virtual size_type 00290 getTraceListeners() const; 00291 00292 virtual void 00293 addTraceListener(TraceListener* tl); 00294 00295 virtual void 00296 removeTraceListener(TraceListener* tl); 00297 00298 virtual void 00299 fireGenerateEvent(const GenerateEvent& ge); 00300 00301 virtual void 00302 fireTraceEvent(const TracerEvent& te); 00303 00304 virtual void 00305 fireSelectEvent(const SelectionEvent& se); 00306 00307 virtual bool 00308 getTraceSelects() const; 00309 00310 virtual void 00311 setTraceSelects(bool b); 00312 00313 virtual void 00314 traceSelect( 00315 const XalanElement& theTemplate, 00316 const NodeRefListBase& nl) const; 00317 00318 virtual void 00319 setQuietConflictWarnings(bool b); 00320 00321 virtual void 00322 setDiagnosticsOutput(PrintWriter* pw); 00323 00324 00325 // Inherited from PrefixResolver... 00326 00335 virtual const XalanDOMString* 00336 getNamespaceForPrefix(const XalanDOMString& prefix) const; 00337 00343 virtual const XalanDOMString& 00344 getURI() const; 00345 00357 XalanDocument* 00358 parseXML( 00359 const XalanDOMString& urlString, 00360 DocumentHandler* docHandler, 00361 XalanDocument* docToRegister); 00362 00374 XalanDocument* 00375 parseXML( 00376 const InputSource& inputSource, 00377 DocumentHandler* docHandler, 00378 XalanDocument* docToRegister); 00379 00392 Stylesheet* 00393 getStylesheetFromPIURL( 00394 const XalanDOMString& xslURLString, 00395 XalanNode& fragBase, 00396 const XalanDOMString& xmlBaseIdent, 00397 bool isRoot, 00398 StylesheetConstructionContext& constructionContext); 00399 00403 void 00404 flushPending(); 00405 00412 void 00413 addResultNamespaceDecl( 00414 const XalanDOMString& prefix, 00415 const XalanDOMString& namespaceVal); 00416 00425 void 00426 addResultAttribute( 00427 AttributeListImpl& attList, 00428 const XalanDOMString& aname, 00429 const XalanDOMString& value); 00430 00438 void 00439 addResultAttribute( 00440 const XalanDOMString& aname, 00441 const XalanDOMString& value) 00442 { 00443 assert(m_outputContextStack.size() > 0); 00444 00445 addResultAttribute(getPendingAttributesImpl(), 00446 aname, 00447 value); 00448 } 00449 00450 void 00451 setDocumentLocator(const Locator* locator); 00452 00453 void 00454 startDocument(); 00455 00456 void 00457 endDocument(); 00458 00459 void 00460 startElement( 00461 const XalanDOMChar* name, 00462 AttributeList& atts); 00463 00464 void 00465 endElement(const XalanDOMChar* name); 00466 00467 void 00468 characters ( 00469 const XalanDOMChar* ch, 00470 XalanDOMString::size_type length); 00471 00472 void 00473 ignorableWhitespace( 00474 const XalanDOMChar* ch, 00475 XalanDOMString::size_type length); 00476 00477 void 00478 processingInstruction( 00479 const XalanDOMChar* target, 00480 const XalanDOMChar* data); 00481 00482 void 00483 resetDocument(); 00484 00492 void 00493 characters( 00494 const XalanDOMChar* ch, 00495 XalanDOMString::size_type start, 00496 XalanDOMString::size_type length); 00497 00503 void 00504 characters(const XalanNode& node); 00505 00511 void 00512 characters(const XObjectPtr& xobject); 00513 00520 void 00521 startElement(const XalanDOMChar* name); 00522 00532 void 00533 charactersRaw( 00534 const XalanDOMChar* ch, 00535 XalanDOMString::size_type start, 00536 XalanDOMString::size_type length); 00537 00543 void 00544 charactersRaw(const XalanNode& node); 00545 00551 void 00552 charactersRaw(const XObjectPtr& xobject); 00553 00559 void 00560 comment(const XalanDOMChar* data); 00561 00568 void 00569 entityReference(const XalanDOMChar* data); 00570 00578 void 00579 cdata( 00580 const XalanDOMChar* ch, 00581 XalanDOMString::size_type start, 00582 XalanDOMString::size_type length); 00583 00594 void 00595 cloneToResultTree( 00596 XalanNode& node, 00597 XalanNode::NodeType nodeType, 00598 bool isLiteral, 00599 bool overrideStrip, 00600 bool shouldCloneAttributes, 00601 const ElemTemplateElement* styleNode = 0); 00602 00609 void 00610 outputResultTreeFragment(const XObject& theTree); 00611 00617 virtual const StylesheetRoot* 00618 getStylesheetRoot() const; 00619 00625 virtual void 00626 setStylesheetRoot(const StylesheetRoot* theStylesheet); 00627 00633 virtual void 00634 setExecutionContext(StylesheetExecutionContext* theExecutionContext); 00635 00642 static const XalanDOMString& 00643 getXSLNameSpaceURL() 00644 { 00645 return s_XSLNameSpaceURL; 00646 } 00647 00653 static const XalanDOMString& 00654 getXalanXSLNameSpaceURL() 00655 { 00656 return s_XSLT4JNameSpaceURL; 00657 } 00658 00664 static double 00665 getXSLTVerSupported(); 00666 00672 static const AttributeKeysMapType& 00673 getAttributeKeys() 00674 { 00675 return s_attributeKeys; 00676 } 00677 00683 static const ElementKeysMapType& 00684 getElementKeys() 00685 { 00686 return s_elementKeys; 00687 } 00688 00697 static int 00698 getElementToken(const XalanDOMString& name) 00699 { 00700 AttributeKeysMapType::const_iterator iter= 00701 s_elementKeys.find(name); 00702 00703 return iter == s_elementKeys.end() ? -2 : (*iter).second; 00704 } 00705 00714 static int 00715 getAttrTok(const XalanDOMString& name) 00716 { 00717 AttributeKeysMapType::const_iterator iter= 00718 s_attributeKeys.find(name); 00719 00720 return iter == s_attributeKeys.end() ? -2 : (*iter).second; 00721 } 00722 00732 int 00733 getXSLToken(const XalanNode& node) const; 00734 00740 bool 00741 getQuietConflictWarnings() const 00742 { 00743 return m_quietConflictWarnings; 00744 } 00745 00746 virtual void 00747 message( 00748 const XalanDOMString& msg, 00749 const XalanNode* sourceNode = 0, 00750 const XalanNode* styleNode = 0) const; 00751 00752 virtual void 00753 message( 00754 const XalanDOMString& msg, 00755 const XalanNode* sourceNode, 00756 const ElemTemplateElement* styleNode) const; 00757 00765 virtual void 00766 message( 00767 const char* msg, 00768 const XalanNode* sourceNode = 0, 00769 const XalanNode* styleNode = 0) const; 00770 00771 virtual void 00772 message( 00773 const XalanDOMString& msg, 00774 const Locator& locator, 00775 const XalanNode* sourceNode = 0) const; 00776 00777 virtual void 00778 warn( 00779 const XalanDOMString& msg, 00780 const XalanNode* sourceNode = 0, 00781 const XalanNode* styleNode = 0) const; 00782 00783 virtual void 00784 warn( 00785 const XalanDOMString& msg, 00786 const XalanNode* sourceNode, 00787 const ElemTemplateElement* styleNode) const; 00788 00796 virtual void 00797 warn( 00798 const char* msg, 00799 const XalanNode* sourceNode = 0, 00800 const XalanNode* styleNode = 0) const; 00801 00802 virtual void 00803 warn( 00804 const XalanDOMString& msg, 00805 const Locator& locator, 00806 const XalanNode* sourceNode = 0) const; 00807 00808 virtual void 00809 error( 00810 const XalanDOMString& msg, 00811 const XalanNode* sourceNode = 0, 00812 const XalanNode* styleNode = 0) const; 00813 00814 virtual void 00815 error( 00816 const XalanDOMString& msg, 00817 const XalanNode* sourceNode, 00818 const ElemTemplateElement* styleNode) const; 00819 00820 virtual void 00821 error( 00822 const XalanDOMString& msg, 00823 const Locator& locator, 00824 const XalanNode* sourceNode = 0) const; 00825 00833 virtual void 00834 error( 00835 const char* msg, 00836 const XalanNode* sourceNode = 0, 00837 const XalanNode* styleNode = 0) const; 00838 00845 void 00846 pushTime(const void* key); 00847 00854 clock_t 00855 popDuration(const void* key); 00856 00864 void 00865 displayDuration( 00866 const XalanDOMString& info, 00867 const void* key); 00868 00869 00875 bool doDiagnosticsOutput() 00876 { 00877 return 0 != m_diagnosticsPrintWriter ? true : false; 00878 } 00879 00885 void 00886 diag(const XalanDOMString& s) const; 00887 00893 void 00894 diag(const char* s) const; 00895 00903 bool 00904 isCDataResultElem(const XalanDOMString& elementName) const; 00905 00912 const XalanDOMString* 00913 getResultNamespaceForPrefix(const XalanDOMString& prefix) const; 00914 00921 const XalanDOMString* 00922 getResultPrefixForNamespace(const XalanDOMString& theNamespace) const; 00923 00932 bool 00933 isPendingResultPrefix(const XalanDOMString& thePrefix) const; 00934 00943 double 00944 evalMatchPatternStr( 00945 const XalanDOMString& str, 00946 XalanNode* context, 00947 XPathExecutionContext& executionContext); 00948 00956 const XPath* 00957 createMatchPattern( 00958 const XalanDOMString& str, 00959 const PrefixResolver& resolver); 00960 00967 void 00968 returnXPath(const XPath* xpath); 00969 00975 void 00976 copyNamespaceAttributes(const XalanNode& src); 00977 00985 const XObjectPtr 00986 evalXPathStr( 00987 const XalanDOMString& str, 00988 XPathExecutionContext& executionContext); 00989 00999 const XObjectPtr 01000 evalXPathStr( 01001 const XalanDOMString& str, 01002 XalanNode* contextNode, 01003 const PrefixResolver& prefixResolver, 01004 XPathExecutionContext& executionContext); 01005 01015 const XObjectPtr 01016 evalXPathStr( 01017 const XalanDOMString& str, 01018 XalanNode* contextNode, 01019 const XalanElement& prefixResolver, 01020 XPathExecutionContext& executionContext); 01021 01029 void 01030 copyAttributeToTarget( 01031 const XalanDOMString& attrName, 01032 const XalanDOMString& attrValue, 01033 AttributeListImpl& attrList); 01034 01040 XPathFactory& 01041 getXPathFactory() 01042 { 01043 return m_xpathFactory; 01044 } 01045 01051 XPathProcessor& 01052 getXPathProcessor() 01053 { 01054 return *m_xpathProcessor.get(); 01055 } 01056 01061 virtual void 01062 reset(); 01063 01068 virtual XalanDocument* 01069 getDOMFactory() const; 01070 01076 XPathEnvSupport& 01077 getXPathEnvSupport() 01078 { 01079 return m_xpathEnvSupport; 01080 } 01081 01090 void 01091 setProblemListener(ProblemListener* l) 01092 { 01093 m_problemListener = l; 01094 } 01095 01104 ProblemListener* 01105 getProblemListener() const 01106 { 01107 return m_problemListener; 01108 } 01109 01110 /* 01111 * Push a new output context using the provided FormatterListener. 01112 * 01113 * @param A pointer to the FormatterListener instance for the new context. 01114 */ 01115 void 01116 pushOutputContext(FormatterListener* theListener) 01117 { 01118 m_outputContextStack.pushContext(theListener); 01119 } 01120 01121 /* 01122 * Pop the current output context. 01123 */ 01124 void 01125 popOutputContext() 01126 { 01127 m_outputContextStack.popContext(); 01128 } 01129 01130 /* 01131 * See if there is a pending start document event waiting. 01132 * @return true if there is a start document event waiting. 01133 */ 01134 bool 01135 getHasPendingStartDocument() const 01136 { 01137 return getHasPendingStartDocumentImpl(); 01138 } 01139 01140 /* 01141 * Set the pending start document event state. 01142 * @param the new value 01143 */ 01144 void 01145 setHasPendingStartDocument(bool b) 01146 { 01147 setHasPendingStartDocumentImpl(b); 01148 } 01149 01150 /* 01151 * See if a pending start document event must be flushed. 01152 * @return true if the event must be flushed. 01153 */ 01154 bool 01155 getMustFlushPendingStartDocument() const 01156 { 01157 return getMustFlushPendingStartDocumentImpl(); 01158 } 01159 01160 /* 01161 * Set the pending start document event flush state. 01162 * @param the new value 01163 */ 01164 void 01165 setMustFlushPendingStartDocument(bool b) 01166 { 01167 setMustFlushPendingStartDocumentImpl(b); 01168 } 01169 01175 const AttributeList& 01176 getPendingAttributes() const 01177 { 01178 return getPendingAttributesImpl(); 01179 } 01180 01186 void 01187 setPendingAttributes(const AttributeList& pendingAttributes) 01188 { 01189 getPendingAttributesImpl() = pendingAttributes; 01190 } 01191 01199 void 01200 replacePendingAttribute( 01201 const XalanDOMChar* theName, 01202 const XalanDOMChar* theNewType, 01203 const XalanDOMChar* theNewValue) 01204 { 01205 // Remove the old attribute, then add the new one. AttributeListImpl::addAttribute() 01206 // does this for us. 01207 getPendingAttributesImpl().addAttribute(theName, theNewType, theNewValue); 01208 } 01209 01210 bool 01211 isElementPending() const 01212 { 01213 return length(getPendingElementNameImpl()) != 0 ? true : false; 01214 } 01215 01221 const XalanDOMString& 01222 getPendingElementName() const 01223 { 01224 return getPendingElementNameImpl(); 01225 } 01226 01232 void 01233 setPendingElementName(const XalanDOMString& elementName) 01234 { 01235 setPendingElementNameImpl(elementName); 01236 } 01237 01238 void 01239 setPendingElementName(const XalanDOMChar* elementName) 01240 { 01241 setPendingElementNameImpl(elementName); 01242 } 01243 01249 const Locator* 01250 getLocatorFromStack() const 01251 { 01252 return m_stylesheetLocatorStack.empty() == true ? 0 : m_stylesheetLocatorStack.back(); 01253 } 01254 01260 void 01261 pushLocatorOnStack(const Locator* locator) 01262 { 01263 m_stylesheetLocatorStack.push_back(locator); 01264 } 01265 01269 void 01270 popLocatorStack() 01271 { 01272 if (m_stylesheetLocatorStack.empty() == false) 01273 { 01274 m_stylesheetLocatorStack.pop_back(); 01275 } 01276 } 01277 01278 protected: 01279 01285 const AttributeListImpl& 01286 getPendingAttributesImpl() const 01287 { 01288 return m_outputContextStack.getPendingAttributes(); 01289 } 01290 01296 AttributeListImpl& 01297 getPendingAttributesImpl() 01298 { 01299 return m_outputContextStack.getPendingAttributes(); 01300 } 01301 01307 void 01308 setPendingAttributesImpl(const AttributeList& pendingAttributes) 01309 { 01310 getPendingAttributesImpl() = pendingAttributes; 01311 } 01312 01318 const XalanDOMString& 01319 getPendingElementNameImpl() const 01320 { 01321 return m_outputContextStack.getPendingElementName(); 01322 } 01323 01329 XalanDOMString& 01330 getPendingElementNameImpl() 01331 { 01332 return m_outputContextStack.getPendingElementName(); 01333 } 01334 01340 void 01341 setPendingElementNameImpl(const XalanDOMString& elementName) 01342 { 01343 m_outputContextStack.getPendingElementName() = elementName; 01344 } 01345 01351 void 01352 setPendingElementNameImpl(const XalanDOMChar* elementName) 01353 { 01354 assert(elementName != 0); 01355 01356 m_outputContextStack.getPendingElementName() = elementName; 01357 } 01358 01359 /* 01360 * See if there is a pending start document event waiting. 01361 * @return true if there is a start document event waiting. 01362 */ 01363 bool 01364 getHasPendingStartDocumentImpl() const 01365 { 01366 return m_outputContextStack.getHasPendingStartDocument(); 01367 } 01368 01369 /* 01370 * Set the pending start document event state. 01371 * @param the new value 01372 */ 01373 void 01374 setHasPendingStartDocumentImpl(bool b) 01375 { 01376 m_outputContextStack.getHasPendingStartDocument() = b; 01377 } 01378 01379 /* 01380 * See if a pending start document event must be flushed. 01381 * @return true if the event must be flushed. 01382 */ 01383 bool 01384 getMustFlushPendingStartDocumentImpl() const 01385 { 01386 return m_outputContextStack.getMustFlushPendingStartDocument(); 01387 } 01388 01389 /* 01390 * Set the pending start document event flush state. 01391 * @param the new value 01392 */ 01393 void 01394 setMustFlushPendingStartDocumentImpl(bool b) 01395 { 01396 m_outputContextStack.getMustFlushPendingStartDocument() = b; 01397 } 01398 01399 FormatterListener* 01400 getFormatterListenerImpl() const 01401 { 01402 return m_outputContextStack.getFormatterListener(); 01403 } 01404 01405 void 01406 setFormatterListenerImpl(FormatterListener* flistener) 01407 { 01408 m_outputContextStack.getFormatterListener() = flistener; 01409 } 01410 01414 bool m_useDOMResultTreeFactory; 01415 01419 mutable XalanDocument* m_domResultTreeFactory; 01420 01427 XalanDOMString m_resultNameSpacePrefix; 01428 01432 XalanDOMString m_resultNameSpaceURL; 01433 01434 01439 void 01440 copyAttributesToAttList( 01441 const XalanNode& node, 01442 AttributeListImpl& attList); 01443 01444 // Factory for creating xpaths. 01445 XPathFactory& m_xpathFactory; 01446 01447 // Factory for creating xobjects 01448 XObjectFactory& m_xobjectFactory; 01449 01450 // The query/pattern-matcher object. 01451 const XPathProcessorPtrType m_xpathProcessor; 01452 01457 BoolVectorType m_cdataStack; 01458 01459 private: 01460 01465 bool 01466 pendingAttributesHasDefaultNS() const; 01467 01468 void 01469 addResultNamespace( 01470 const XalanNode& theNode, 01471 AttributeListImpl& thePendingAttributes, 01472 bool fOnlyIfPrefixNotPresent = false); 01473 01478 LocatorStack m_stylesheetLocatorStack; 01479 01486 ProblemListenerDefault m_defaultProblemListener; 01487 01488 ProblemListener* m_problemListener; 01489 01493 const StylesheetRoot* m_stylesheetRoot; 01494 01498 static const XalanDOMString& s_XSLNameSpaceURL; //"http://www.w3.org/1999/XSL/Transform" 01499 01503 static const double s_XSLTVerSupported; // 1.0 01504 01508 static const XalanDOMString& s_XSLT4JNameSpaceURL; // "http://xml.apache.org/xslt" 01509 01513 static const XalanDOMString& s_uniqueNamespacePrefix; 01514 01518 static const ElementKeysMapType& s_XSLT4JElementKeys; 01519 01523 static const AttributeKeysMapType& s_attributeKeys; 01524 01528 static const ElementKeysMapType& s_elementKeys; 01529 01533 bool m_traceSelects; 01534 01539 bool m_quietConflictWarnings; 01540 01541 /* 01542 * A stream to print diagnostics to. 01543 */ 01544 PrintWriter* m_diagnosticsPrintWriter; 01545 01546 /* For diagnostics */ 01547 DurationsTableMapType m_durationsTable; 01548 01553 TraceListenerVectorType m_traceListeners; 01554 01555 // Common processing for errors and warnings 01556 void 01557 problem( 01558 const XalanDOMString& msg, 01559 ProblemListener::eClassification classification, 01560 const XalanNode* sourceNode, 01561 const XalanNode* styleNode) const; 01562 01563 void 01564 problem( 01565 const XalanDOMString& msg, 01566 ProblemListener::eClassification classification, 01567 const XalanNode* sourceNode, 01568 const ElemTemplateElement* styleNode) const; 01569 01570 void 01571 problem( 01572 const XalanDOMString& msg, 01573 ProblemListener::eClassification classification, 01574 const Locator& locator, 01575 const XalanNode* sourceNode) const; 01576 01577 //========================================================== 01578 // SECTION: Function to do with attribute handling 01579 //========================================================== 01580 01584 unsigned long m_uniqueNSValue; 01585 01586 ParamVectorType m_topLevelParams; 01587 01588 public: 01589 01593 void 01594 clearTopLevelParams() 01595 { 01596 m_topLevelParams.clear(); 01597 } 01598 01599 private: 01600 01601 bool 01602 generateCDATASection() const 01603 { 01604 return 0 != m_cdataStack.size() && 01605 m_cdataStack.back() == true; 01606 } 01607 01608 void 01609 doFlushPending() 01610 { 01611 setMustFlushPendingStartDocument(true); 01612 01613 flushPending(); 01614 } 01615 01616 void 01617 fireCharacterGenerateEvent( 01618 const XalanNode& theNode, 01619 bool isCDATA); 01620 01621 void 01622 fireCharacterGenerateEvent( 01623 const XObjectPtr& theXObject, 01624 bool isCDATA); 01625 01626 void 01627 fireCharacterGenerateEvent( 01628 const XalanDOMString& theString, 01629 bool isCDATA); 01630 01631 void 01632 fireCharacterGenerateEvent( 01633 const XalanDOMChar* ch, 01634 XalanDOMString::size_type start, 01635 XalanDOMString::size_type length, 01636 bool isCDATA); 01637 01638 01639 XMLParserLiaison& m_parserLiaison; 01640 01641 XPathEnvSupport& m_xpathEnvSupport; 01642 01643 DOMSupport& m_domSupport; 01644 01648 StylesheetExecutionContext* m_executionContext; 01649 01650 /* 01651 * Stack of current output contexts... 01652 */ 01653 OutputContextStack m_outputContextStack; 01654 01655 /* 01656 * Stack of current result namespaces... 01657 */ 01658 ResultNamespacesStack m_resultNamespacesStack; 01659 01660 /* 01661 * Dummy AttributeListImpl 01662 */ 01663 AttributeListImpl m_dummyAttributesList; 01664 01665 XalanDOMString m_scratchString; 01666 01667 static void 01668 installFunctions(); 01669 01670 static void 01671 uninstallFunctions(); 01672 01673 static void 01674 initializeAttributeKeysTable(AttributeKeysMapType& theAttributeKeys); 01675 01676 static void 01677 initializeElementKeysTable(ElementKeysMapType& theElementKeys); 01678 01679 static void 01680 initializeXSLT4JElementKeys(ElementKeysMapType& theElementKeys); 01681 01682 static const XalanDOMString s_emptyString; 01683 }; 01684 01685 01686 01687 #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.3 |
|