00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999-2003 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 * @author <a href="mailto:david_n_bertoni@lotus.com">David N. Bertoni</a> 00058 */ 00059 #if !defined(STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680) 00060 #define STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680 00061 00062 00063 00064 // Base include file. Must be first. 00065 #include <xalanc/XSLT/XSLTDefinitions.hpp> 00066 00067 00068 00069 #include <cstddef> 00070 #include <cstdio> 00071 #include <memory> 00072 00073 00074 00075 // Base class header file... 00076 #include <xalanc/XPath/XPathExecutionContext.hpp> 00077 00078 00079 00080 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00081 00082 00083 00084 // Base class header file... 00085 #include <xalanc/PlatformSupport/ExecutionContext.hpp> 00086 00087 00088 00089 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION) 00090 #include <xalanc/PlatformSupport/XalanNumberFormat.hpp> 00091 #endif 00092 00093 00094 00095 #include <xalanc/Include/XalanAutoPtr.hpp> 00096 00097 00098 00099 #include <xalanc/PlatformSupport/AttributeListImpl.hpp> 00100 00101 00102 00103 #include <xalanc/XSLT/TopLevelArg.hpp> 00104 00105 00106 00107 XALAN_CPP_NAMESPACE_BEGIN 00108 00109 00110 00111 class CountersTable; 00112 class ElemTemplate; 00113 class ElemTemplateElement; 00114 class ElemVariable; 00115 class FormatterListener; 00116 class FormatterToText; 00117 class GenerateEvent; 00118 class KeyDeclaration; 00119 class PrefixResolver; 00120 class NodeRefListBase; 00121 class NodeSorter; 00122 class PrintWriter; 00123 class XalanQName; 00124 class SelectionEvent; 00125 class Stylesheet; 00126 class StylesheetRoot; 00127 class XalanOutputStream; 00128 class TracerEvent; 00129 class Writer; 00130 class XalanDocument; 00131 class XalanDocumentFragment; 00132 class XalanElement; 00133 class XalanNode; 00134 class XalanNumberFormat; 00135 class XPath; 00136 class XObject; 00137 class XObjectPtr; 00138 class XResultTreeFrag; 00139 00140 00141 00142 // 00143 // An abstract class which provides support for executing stylesheets. 00144 // 00145 class XALAN_XSLT_EXPORT StylesheetExecutionContext : public XPathExecutionContext 00146 { 00147 public: 00148 00149 #if defined(XALAN_NO_STD_NAMESPACE) 00150 typedef ostream StreamType; 00151 #else 00152 typedef std::ostream StreamType; 00153 #endif 00154 00155 typedef size_t size_type; 00156 00157 explicit 00158 StylesheetExecutionContext(XObjectFactory* theXObjectFactory = 0); 00159 00160 virtual 00161 ~StylesheetExecutionContext(); 00162 00163 // These interfaces are new... 00164 00172 virtual void 00173 error( 00174 const XalanDOMString& msg, 00175 const ElemTemplateElement& styleNode, 00176 const XalanNode* sourceNode = 0) const = 0; 00177 00185 virtual void 00186 error( 00187 const char* msg, 00188 const ElemTemplateElement& styleNode, 00189 const XalanNode* sourceNode = 0) const = 0; 00190 00198 virtual void 00199 warn( 00200 const XalanDOMString& msg, 00201 const ElemTemplateElement& styleNode, 00202 const XalanNode* sourceNode = 0) const = 0; 00203 00211 virtual void 00212 warn( 00213 const char* msg, 00214 const ElemTemplateElement& styleNode, 00215 const XalanNode* sourceNode = 0) const = 0; 00216 00224 virtual void 00225 message( 00226 const XalanDOMString& msg, 00227 const ElemTemplateElement& styleNode, 00228 const XalanNode* sourceNode = 0) const = 0; 00229 00230 00238 virtual void 00239 message( 00240 const char* msg, 00241 const ElemTemplateElement& styleNode, 00242 const XalanNode* sourceNode = 0) const = 0; 00243 00249 virtual bool 00250 getQuietConflictWarnings() const = 0; 00251 00258 virtual bool 00259 getCopyTextNodesOnly() const = 0; 00260 00267 virtual void 00268 setCopyTextNodesOnly(bool fValue) = 0; 00269 00270 /* 00271 * A class to manage setting and restoring the flag 00272 * for restricting copying only text nodes to the 00273 * result tree 00274 */ 00275 class SetAndRestoreCopyTextNodesOnly 00276 { 00277 public: 00278 00279 SetAndRestoreCopyTextNodesOnly( 00280 StylesheetExecutionContext& executionContext, 00281 bool fValue) : 00282 m_executionContext(executionContext), 00283 m_fValue(executionContext.getCopyTextNodesOnly()) 00284 { 00285 executionContext.setCopyTextNodesOnly(fValue); 00286 } 00287 00288 ~SetAndRestoreCopyTextNodesOnly() 00289 { 00290 m_executionContext.setCopyTextNodesOnly(m_fValue); 00291 } 00292 00293 private: 00294 00295 // Not implemented... 00296 SetAndRestoreCopyTextNodesOnly(const SetAndRestoreCopyTextNodesOnly&); 00297 00298 SetAndRestoreCopyTextNodesOnly& 00299 operator=(const SetAndRestoreCopyTextNodesOnly&); 00300 00301 // Data members... 00302 StylesheetExecutionContext& m_executionContext; 00303 00304 const bool m_fValue; 00305 }; 00306 00314 virtual XalanNode* 00315 getRootDocument() const = 0; 00316 00324 virtual void 00325 setRootDocument(XalanNode* theDocument) = 0; 00326 00332 virtual XalanDocument* 00333 createDocument() const = 0; 00334 00340 virtual void 00341 setStylesheetRoot(const StylesheetRoot* theStylesheet) = 0; 00342 00348 virtual const XalanQName* 00349 getCurrentMode() const = 0; 00350 00356 virtual void 00357 setCurrentMode(const XalanQName* theMode) = 0; 00358 00364 virtual const ElemTemplate* 00365 getCurrentTemplate() const = 0; 00366 00372 virtual void 00373 setCurrentTemplate(const ElemTemplate* theTemplate) = 0; 00374 00375 /* 00376 * A class to manage setting and restoring the current 00377 * template instance. 00378 */ 00379 class SetAndRestoreCurrentTemplate 00380 { 00381 public: 00382 00383 SetAndRestoreCurrentTemplate( 00384 StylesheetExecutionContext& executionContext, 00385 const ElemTemplate* theTemplate) : 00386 m_executionContext(executionContext), 00387 m_template(executionContext.getCurrentTemplate()) 00388 { 00389 executionContext.setCurrentTemplate(theTemplate); 00390 } 00391 00392 ~SetAndRestoreCurrentTemplate() 00393 { 00394 m_executionContext.setCurrentTemplate(m_template); 00395 } 00396 00397 private: 00398 00399 // Not implemented... 00400 SetAndRestoreCurrentTemplate(const SetAndRestoreCurrentTemplate&); 00401 00402 SetAndRestoreCurrentTemplate& 00403 operator=(const SetAndRestoreCurrentTemplate&); 00404 00405 // Data members... 00406 StylesheetExecutionContext& m_executionContext; 00407 00408 const ElemTemplate* const m_template; 00409 }; 00410 00416 virtual bool 00417 doDiagnosticsOutput() const = 0; 00418 00424 virtual void 00425 diag(const XalanDOMString& theString) = 0; 00426 00433 virtual void 00434 pushTime(const void* theKey) = 0; 00435 00442 virtual void 00443 displayDuration( 00444 const XalanDOMString& theMessage, 00445 const void* theKey) = 0; 00446 00450 virtual bool 00451 isElementPending() const = 0; 00452 00460 virtual void 00461 replacePendingAttribute( 00462 const XalanDOMChar* theName, 00463 const XalanDOMChar* theNewType, 00464 const XalanDOMChar* theNewValue) = 0; 00465 00471 virtual FormatterListener* 00472 getFormatterListener() const = 0; 00473 00479 virtual void 00480 setFormatterListener(FormatterListener* flistener) = 0; 00481 00482 virtual void 00483 pushOutputContext(FormatterListener* flistener = 0) = 0; 00484 00485 virtual void 00486 popOutputContext() = 0; 00487 00488 class OutputContextPushPop 00489 { 00490 public: 00491 00498 OutputContextPushPop( 00499 StylesheetExecutionContext& theExecutionContext, 00500 FormatterListener* theNewListener = 0) : 00501 m_executionContext(theExecutionContext) 00502 { 00503 m_executionContext.pushOutputContext(theNewListener); 00504 } 00505 00506 ~OutputContextPushPop() 00507 { 00508 m_executionContext.popOutputContext(); 00509 } 00510 00511 private: 00512 00513 StylesheetExecutionContext& m_executionContext; 00514 }; 00515 00522 virtual void 00523 addResultAttribute( 00524 const XalanDOMString& aname, 00525 const XalanDOMString& value) = 0; 00526 00533 virtual void 00534 addResultAttribute( 00535 const XalanDOMString& aname, 00536 const XalanDOMChar* value) = 0; 00537 00543 virtual void 00544 copyNamespaceAttributes(const XalanNode& src) = 0; 00545 00553 virtual const XalanDOMString* 00554 getResultPrefixForNamespace(const XalanDOMString& theNamespace) const = 0; 00555 00563 virtual const XalanDOMString* 00564 getResultNamespaceForPrefix(const XalanDOMString& thePrefix) const = 0; 00565 00574 virtual bool 00575 isPendingResultPrefix(const XalanDOMString& thePrefix) = 0; 00576 00582 virtual XalanDOMString 00583 getUniqueNamespaceValue() const = 0; 00584 00590 virtual void 00591 getUniqueNamespaceValue(XalanDOMString& theValue) const = 0; 00592 00598 virtual int 00599 getIndent() const = 0; 00600 00606 virtual void 00607 setIndent(int indentAmount) = 0; 00608 00617 virtual const XPath* 00618 createMatchPattern( 00619 const XalanDOMString& str, 00620 const PrefixResolver& resolver) = 0; 00621 00627 virtual void 00628 returnXPath(const XPath* xpath) = 0; 00629 00630 // A helper class to automatically return an XPath instance. 00631 class XPathGuard 00632 { 00633 public: 00634 00635 XPathGuard( 00636 StylesheetExecutionContext& context, 00637 const XPath* xpath = 0) : 00638 m_context(context), 00639 m_xpath(xpath) 00640 { 00641 } 00642 00643 ~XPathGuard() 00644 { 00645 if (m_xpath != 0) 00646 { 00647 m_context.returnXPath(m_xpath); 00648 } 00649 } 00650 00651 const XPath* 00652 get() const 00653 { 00654 return m_xpath; 00655 } 00656 00657 const XPath* 00658 release() 00659 { 00660 const XPath* const temp = m_xpath; 00661 00662 m_xpath = 0; 00663 00664 return temp; 00665 } 00666 00667 void 00668 reset(const XPath* xpath) 00669 { 00670 if (m_xpath != 0) 00671 { 00672 m_context.returnXPath(m_xpath); 00673 } 00674 00675 m_xpath = xpath; 00676 } 00677 00678 private: 00679 00680 StylesheetExecutionContext& m_context; 00681 00682 const XPath* m_xpath; 00683 }; 00684 00685 #if defined(XALAN_NO_STD_NAMESPACE) 00686 typedef vector<TopLevelArg> ParamVectorType; 00687 #else 00688 typedef std::vector<TopLevelArg> ParamVectorType; 00689 #endif 00690 00697 virtual void 00698 pushTopLevelVariables(const ParamVectorType& topLevelParams) = 0; 00699 00709 virtual const XObjectPtr 00710 createVariable( 00711 const XPath& xpath, 00712 XalanNode* contextNode, 00713 const PrefixResolver& resolver) = 0; 00714 00723 virtual const XObjectPtr 00724 createVariable( 00725 const ElemTemplateElement& templateChild, 00726 XalanNode* sourceNode) = 0; 00727 00740 virtual void 00741 pushVariable( 00742 const XalanQName& name, 00743 const ElemTemplateElement* element, 00744 const XalanDOMString& str, 00745 XalanNode* contextNode, 00746 const PrefixResolver& resolver) = 0; 00747 00759 virtual void 00760 pushVariable( 00761 const XalanQName& name, 00762 const ElemTemplateElement* element, 00763 const XPath& xpath, 00764 XalanNode* contextNode, 00765 const PrefixResolver& resolver) = 0; 00766 00776 virtual void 00777 pushVariable( 00778 const XalanQName& name, 00779 const ElemTemplateElement* element, 00780 const ElemTemplateElement& templateChild, 00781 XalanNode* sourceNode) = 0; 00782 00791 virtual void 00792 pushVariable( 00793 const XalanQName& name, 00794 const XObjectPtr val, 00795 const ElemTemplateElement* element) = 0; 00796 00805 virtual void 00806 pushVariable( 00807 const XalanQName& name, 00808 const ElemVariable* var, 00809 const ElemTemplateElement* element) = 0; 00810 00815 virtual void 00816 pushContextMarker() = 0; 00817 00821 virtual void 00822 popContextMarker() = 0; 00823 00824 /* 00825 * A class to manage pushing and popping an element's stack 00826 * frame context. 00827 */ 00828 class PushAndPopContextMarker 00829 { 00830 public: 00831 00832 PushAndPopContextMarker(StylesheetExecutionContext& executionContext) : 00833 m_executionContext(executionContext) 00834 { 00835 executionContext.pushContextMarker(); 00836 } 00837 00838 ~PushAndPopContextMarker() 00839 { 00840 m_executionContext.popContextMarker(); 00841 } 00842 00843 private: 00844 00845 StylesheetExecutionContext& m_executionContext; 00846 }; 00847 00851 virtual void 00852 resolveTopLevelParams() = 0; 00853 00857 virtual void 00858 clearTopLevelParams() = 0; 00859 00860 class ResolveAndClearTopLevelParams 00861 { 00862 public: 00863 00864 ResolveAndClearTopLevelParams(StylesheetExecutionContext& executionContext) : 00865 m_executionContext(executionContext) 00866 { 00867 m_executionContext.resolveTopLevelParams(); 00868 } 00869 00870 ~ResolveAndClearTopLevelParams() 00871 { 00872 m_executionContext.clearTopLevelParams(); 00873 } 00874 00875 private: 00876 00877 StylesheetExecutionContext& m_executionContext; 00878 }; 00879 00888 virtual void 00889 pushParams( 00890 const ElemTemplateElement& xslCallTemplateElement, 00891 XalanNode* sourceNode, 00892 const ElemTemplateElement* targetTemplate) = 0; 00893 00901 virtual const XObjectPtr 00902 getParamVariable(const XalanQName& theName) = 0; 00903 00909 virtual void 00910 pushElementFrame(const ElemTemplateElement* elem) = 0; 00911 00917 virtual void 00918 popElementFrame(const ElemTemplateElement* elem) = 0; 00919 00920 /* 00921 * A class to manage pushing and popping an element's stack 00922 * frame context. 00923 */ 00924 class PushAndPopElementFrame 00925 { 00926 public: 00927 00928 PushAndPopElementFrame( 00929 StylesheetExecutionContext& executionContext, 00930 const ElemTemplateElement* element) : 00931 m_executionContext(executionContext), 00932 m_element(element) 00933 { 00934 executionContext.pushElementFrame(element); 00935 } 00936 00937 ~PushAndPopElementFrame() 00938 { 00939 m_executionContext.popElementFrame(m_element); 00940 } 00941 00942 private: 00943 00944 StylesheetExecutionContext& m_executionContext; 00945 00946 const ElemTemplateElement* m_element; 00947 }; 00948 00954 virtual int 00955 getGlobalStackFrameIndex() const = 0; 00956 00963 virtual int 00964 getCurrentStackFrameIndex() const = 0; 00965 00972 virtual void 00973 setCurrentStackFrameIndex(int currentStackFrameIndex = -1) = 0; 00974 00975 /* 00976 * A class to manage the state of the variable stacks frame index. 00977 */ 00978 class SetAndRestoreCurrentStackFrameIndex 00979 { 00980 public: 00981 00982 SetAndRestoreCurrentStackFrameIndex( 00983 StylesheetExecutionContext& executionContext, 00984 int newIndex) : 00985 m_executionContext(executionContext), 00986 m_savedIndex(executionContext.getCurrentStackFrameIndex()) 00987 { 00988 executionContext.setCurrentStackFrameIndex(newIndex); 00989 } 00990 00991 ~SetAndRestoreCurrentStackFrameIndex() 00992 { 00993 m_executionContext.setCurrentStackFrameIndex(m_savedIndex); 00994 } 00995 00996 int 00997 getStackFrameIndex() const 00998 { 00999 return m_savedIndex; 01000 } 01001 01002 private: 01003 01004 StylesheetExecutionContext& m_executionContext; 01005 01006 const int m_savedIndex; 01007 }; 01008 01009 /* 01010 * A class to manage stack state during execution. 01011 */ 01012 class ParamsPushPop 01013 { 01014 public: 01015 01016 ParamsPushPop( 01017 StylesheetExecutionContext& executionContext, 01018 const ElemTemplateElement& xslCallTemplateElement, 01019 XalanNode* sourceNode, 01020 const ElemTemplateElement* targetTemplate); 01021 01022 ~ParamsPushPop(); 01023 01024 int 01025 getStackFrameIndex() const 01026 { 01027 return m_savedStackFrameIndex; 01028 } 01029 01030 private: 01031 01032 StylesheetExecutionContext& m_executionContext; 01033 01034 const int m_savedStackFrameIndex; 01035 }; 01036 01046 virtual void 01047 startDocument() = 0; 01048 01060 virtual void 01061 endDocument() = 0; 01062 01068 virtual void 01069 startElement(const XalanDOMChar* name) = 0; 01070 01076 virtual void 01077 endElement(const XalanDOMChar* name) = 0; 01078 01086 virtual void 01087 characters( 01088 const XalanDOMChar* ch, 01089 XalanDOMString::size_type start, 01090 XalanDOMString::size_type length) = 0; 01091 01101 virtual void 01102 charactersRaw( 01103 const XalanDOMChar* ch, 01104 XalanDOMString::size_type start, 01105 XalanDOMString::size_type length) = 0; 01106 01112 virtual void 01113 comment(const XalanDOMChar* data) = 0; 01114 01121 virtual void 01122 processingInstruction( 01123 const XalanDOMChar* target, 01124 const XalanDOMChar* data) = 0; 01125 01129 virtual void 01130 flushPending() = 0; 01131 01138 virtual void 01139 cloneToResultTree( 01140 const XalanNode& node, 01141 const LocatorType* locator) = 0; 01142 01153 virtual void 01154 cloneToResultTree( 01155 const XalanNode& node, 01156 XalanNode::NodeType nodeType, 01157 bool isLiteral, 01158 bool overrideStrip, 01159 bool shouldCloneAttributes, 01160 const LocatorType* locator) = 0; 01161 01169 virtual const XObjectPtr 01170 createXResultTreeFrag( 01171 const ElemTemplateElement& templateChild, 01172 XalanNode* sourceNode) = 0; 01173 01181 virtual void 01182 outputToResultTree( 01183 const XObject& xobj, 01184 const LocatorType* locator) = 0; 01185 01193 virtual void 01194 outputResultTreeFragment( 01195 const XObject& theTree, 01196 const LocatorType* locator) = 0; 01197 01203 virtual const XalanDOMString& 01204 getXSLNameSpaceURL() const = 0; 01205 01211 virtual const XalanDOMString& 01212 getXalanXSLNameSpaceURL() const = 0; 01213 01219 virtual bool 01220 findOnElementRecursionStack(const ElemTemplateElement* theElement) const = 0; 01221 01227 virtual void 01228 pushOnElementRecursionStack(const ElemTemplateElement* theElement) = 0; 01229 01235 virtual const ElemTemplateElement* 01236 popElementRecursionStack() = 0; 01237 01241 class ElementRecursionStackPusher 01242 { 01243 public: 01244 01251 ElementRecursionStackPusher( 01252 StylesheetExecutionContext& executionContext, 01253 const ElemTemplateElement* element) : 01254 m_executionContext(executionContext) 01255 { 01256 m_executionContext.pushOnElementRecursionStack(element); 01257 } 01258 01259 ~ElementRecursionStackPusher() 01260 { 01261 m_executionContext.popElementRecursionStack(); 01262 } 01263 01264 private: 01265 01266 StylesheetExecutionContext& m_executionContext; 01267 }; 01268 01269 01279 virtual bool 01280 returnXResultTreeFrag(XResultTreeFrag* theXResultTreeFrag) = 0; 01281 01282 01283 enum eDummy 01284 { 01285 eDefaultXMLIndentAmount = 0, 01286 eDefaultHTMLIndentAmount = 0 01287 }; 01288 01292 enum eEscapeURLs 01293 { 01294 eEscapeURLsDefault, // Use the value in the stylesheet 01295 eEscapeURLsNo, // Don't escape URLs 01296 eEscapeURLsYes // Escape URLs 01297 }; 01298 01306 virtual eEscapeURLs 01307 getEscapeURLs() const = 0; 01308 01316 virtual void 01317 setEscapeURLs(eEscapeURLs value) = 0; 01318 01319 01323 enum eOmitMETATag 01324 { 01325 eOmitMETATagDefault, // Use the value in the stylesheet 01326 eOmitMETATagNo, // Don't omit the META tag 01327 eOmitMETATagYes // Omit the META tag 01328 }; 01329 01337 virtual eOmitMETATag 01338 getOmitMETATag() const = 0; 01339 01347 virtual void 01348 setOmitMETATag(eOmitMETATag value) = 0; 01349 01370 virtual FormatterListener* 01371 createFormatterToXML( 01372 Writer& writer, 01373 const XalanDOMString& version = XalanDOMString(), 01374 bool doIndent = false, 01375 int indent = eDefaultXMLIndentAmount, 01376 const XalanDOMString& encoding = XalanDOMString(), 01377 const XalanDOMString& mediaType = XalanDOMString(), 01378 const XalanDOMString& doctypeSystem = XalanDOMString(), 01379 const XalanDOMString& doctypePublic = XalanDOMString(), 01380 bool xmlDecl = true, 01381 const XalanDOMString& standalone = XalanDOMString()) = 0; 01382 01400 virtual FormatterListener* 01401 createFormatterToHTML( 01402 Writer& writer, 01403 const XalanDOMString& encoding = XalanDOMString(), 01404 const XalanDOMString& mediaType = XalanDOMString(), 01405 const XalanDOMString& doctypeSystem = XalanDOMString(), 01406 const XalanDOMString& doctypePublic = XalanDOMString(), 01407 bool doIndent = true, 01408 int indent = eDefaultHTMLIndentAmount, 01409 bool escapeURLs = true, 01410 bool omitMetaTag = false) = 0; 01411 01418 virtual FormatterListener* 01419 createFormatterToText( 01420 Writer& writer, 01421 const XalanDOMString& encoding) = 0; 01422 01423 class BorrowReturnFormatterToText 01424 { 01425 public: 01426 01427 BorrowReturnFormatterToText( 01428 StylesheetExecutionContext& executionContext, 01429 Writer& writer, 01430 bool normalizeLinefeed = true, 01431 bool handleIgnorableWhitespace = true); 01432 01433 ~BorrowReturnFormatterToText() 01434 { 01435 assert(m_formatter != 0); 01436 01437 m_executionContext.returnFormatterToText(m_formatter); 01438 } 01439 01440 FormatterToText& 01441 operator*() const 01442 { 01443 assert(m_formatter != 0); 01444 01445 return *m_formatter; 01446 } 01447 01448 FormatterToText* 01449 get() const 01450 { 01451 assert(m_formatter != 0); 01452 01453 return m_formatter; 01454 } 01455 01456 FormatterToText* 01457 operator->() const 01458 { 01459 return get(); 01460 } 01461 01462 private: 01463 01464 StylesheetExecutionContext& m_executionContext; 01465 01466 FormatterToText* m_formatter; 01467 }; 01468 01469 01470 friend class BorrowReturnFormatterToText; 01471 01477 virtual NodeSorter* 01478 borrowNodeSorter() = 0; 01479 01486 virtual bool 01487 returnNodeSorter(NodeSorter* theSorter) = 0; 01488 01489 class BorrowReturnNodeSorter 01490 { 01491 public: 01492 01493 BorrowReturnNodeSorter(StylesheetExecutionContext& executionContext) : 01494 m_executionContext(executionContext), 01495 m_sorter(executionContext.borrowNodeSorter()) 01496 { 01497 assert(m_sorter != 0); 01498 } 01499 01500 ~BorrowReturnNodeSorter() 01501 { 01502 assert(m_sorter != 0); 01503 01504 m_executionContext.returnNodeSorter(m_sorter); 01505 } 01506 01507 NodeSorter& 01508 operator*() const 01509 { 01510 assert(m_sorter != 0); 01511 01512 return *m_sorter; 01513 } 01514 01515 NodeSorter* 01516 get() const 01517 { 01518 assert(m_sorter != 0); 01519 01520 return m_sorter; 01521 } 01522 01523 NodeSorter* 01524 operator->() const 01525 { 01526 return get(); 01527 } 01528 01529 private: 01530 01531 StylesheetExecutionContext& m_executionContext; 01532 01533 NodeSorter* m_sorter; 01534 }; 01535 01536 01537 typedef XalanAutoPtr<XalanNumberFormat> XalanNumberFormatAutoPtr; 01538 01545 virtual XalanNumberFormatAutoPtr 01546 createXalanNumberFormat() = 0; 01547 01548 01549 // Trace interface... 01550 01556 virtual size_type 01557 getTraceListeners() const = 0; 01558 01564 virtual void 01565 fireGenerateEvent(const GenerateEvent& ge) = 0; 01566 01572 virtual void 01573 fireTraceEvent(const TracerEvent& te) = 0; 01574 01580 virtual void 01581 fireSelectEvent(const SelectionEvent& se) = 0; 01582 01588 virtual bool 01589 getTraceSelects() const = 0; 01590 01598 virtual void 01599 traceSelect( 01600 const ElemTemplateElement& theStylesheetElement, 01601 const NodeRefListBase& nl, 01602 const XPath* xpath) = 0; 01603 01604 enum eCaseOrder { eDefault, eLowerFirst, eUpperFirst }; 01605 01615 virtual int 01616 collationCompare( 01617 const XalanDOMString& theLHS, 01618 const XalanDOMString& theRHS, 01619 eCaseOrder theCaseOrder = eDefault) = 0; 01620 01631 virtual int 01632 collationCompare( 01633 const XalanDOMString& theLHS, 01634 const XalanDOMString& theRHS, 01635 const XalanDOMString& theLocale, 01636 eCaseOrder theCaseOrder = eDefault) = 0; 01637 01647 virtual int 01648 collationCompare( 01649 const XalanDOMChar* theLHS, 01650 const XalanDOMChar* theRHS, 01651 eCaseOrder theCaseOrder = eDefault) = 0; 01652 01663 virtual int 01664 collationCompare( 01665 const XalanDOMChar* theLHS, 01666 const XalanDOMChar* theRHS, 01667 const XalanDOMChar* theLocale, 01668 eCaseOrder theCaseOrder = eDefault) = 0; 01669 01676 virtual bool 01677 getInConstruction(const KeyDeclaration& keyDeclaration) const = 0; 01678 01684 virtual void 01685 beginConstruction(const KeyDeclaration& keyDeclaration) = 0; 01686 01692 virtual void 01693 endConstruction(const KeyDeclaration& keyDeclaration) = 0; 01694 01701 virtual PrintWriter* 01702 createPrintWriter(XalanOutputStream* theTextOutputStream) = 0; 01703 01712 virtual PrintWriter* 01713 createPrintWriter( 01714 const XalanDOMString& theFileName, 01715 const XalanDOMString& theEncoding) = 0; 01716 01723 virtual PrintWriter* 01724 createPrintWriter(StreamType& theStream) = 0; 01725 01732 virtual PrintWriter* 01733 createPrintWriter(FILE* theStream) = 0; 01734 01741 virtual CountersTable& 01742 getCountersTable() = 0; 01743 01749 virtual void 01750 characters(const XalanNode& node) = 0; 01751 01757 virtual void 01758 characters(const XObjectPtr& xobject) = 0; 01759 01766 virtual void 01767 charactersRaw(const XalanNode& node) = 0; 01768 01774 virtual void 01775 charactersRaw(const XObjectPtr& xobject) = 0; 01776 01777 01778 // These interfaces are inherited from XPathExecutionContext... 01779 01780 virtual void 01781 reset() = 0; 01782 01783 virtual XalanNode* 01784 getCurrentNode() const = 0; 01785 01786 virtual void 01787 setCurrentNode(XalanNode* theCurrentNode) = 0; 01788 01789 virtual bool 01790 isNodeAfter( 01791 const XalanNode& node1, 01792 const XalanNode& node2) const = 0; 01793 01794 virtual const NodeRefListBase& 01795 getContextNodeList() const = 0; 01796 01797 virtual void 01798 setContextNodeList(const NodeRefListBase& theList) = 0; 01799 01800 virtual size_type 01801 getContextNodeListLength() const = 0; 01802 01803 virtual size_type 01804 getContextNodeListPosition(const XalanNode& contextNode) const = 0; 01805 01813 virtual bool 01814 elementAvailable(const XalanQName& theQName) const = 0; 01815 01825 virtual bool 01826 elementAvailable( 01827 const XalanDOMString& theName, 01828 const LocatorType* locator) const = 0; 01829 01837 virtual bool 01838 functionAvailable(const XalanQName& theQName) const = 0; 01839 01848 virtual bool 01849 functionAvailable( 01850 const XalanDOMString& theName, 01851 const LocatorType* locator) const = 0; 01852 01853 virtual const XObjectPtr 01854 extFunction( 01855 const XalanDOMString& theNamespace, 01856 const XalanDOMString& functionName, 01857 XalanNode* context, 01858 const XObjectArgVectorType& argVec, 01859 const LocatorType* locator) = 0; 01860 01861 virtual XalanDocument* 01862 parseXML( 01863 const XalanDOMString& urlString, 01864 const XalanDOMString& base) const = 0; 01865 01866 virtual MutableNodeRefList* 01867 borrowMutableNodeRefList() = 0; 01868 01869 virtual bool 01870 returnMutableNodeRefList(MutableNodeRefList* theList) = 0; 01871 01872 virtual MutableNodeRefList* 01873 createMutableNodeRefList() const = 0; 01874 01875 virtual XalanDOMString& 01876 getCachedString() = 0; 01877 01878 virtual bool 01879 releaseCachedString(XalanDOMString& theString) = 0; 01880 01881 virtual void 01882 getNodeSetByKey( 01883 XalanDocument* doc, 01884 const XalanQName& qname, 01885 const XalanDOMString& ref, 01886 MutableNodeRefList& nodelist) = 0; 01887 01888 virtual void 01889 getNodeSetByKey( 01890 XalanDocument* doc, 01891 const XalanDOMString& name, 01892 const XalanDOMString& ref, 01893 const LocatorType* locator, 01894 MutableNodeRefList& nodelist) = 0; 01895 01896 virtual const XObjectPtr 01897 getVariable( 01898 const XalanQName& name, 01899 const LocatorType* locator = 0) = 0; 01900 01901 virtual const PrefixResolver* 01902 getPrefixResolver() const = 0; 01903 01904 virtual void 01905 setPrefixResolver(const PrefixResolver* thePrefixResolver) = 0; 01906 01907 virtual const XalanDOMString* 01908 getNamespaceForPrefix(const XalanDOMString& prefix) const = 0; 01909 01910 virtual XalanDOMString 01911 findURIFromDoc(const XalanDocument* owner) const = 0; 01912 01913 virtual const XalanDOMString& 01914 getUnparsedEntityURI( 01915 const XalanDOMString& theName, 01916 const XalanDocument& theDocument) const = 0; 01917 01918 virtual bool 01919 shouldStripSourceNode(const XalanNode& node) = 0; 01920 01921 virtual bool 01922 getThrowFoundIndex() const = 0; 01923 01924 virtual void 01925 setThrowFoundIndex(bool fThrow) = 0; 01926 01927 virtual XalanDocument* 01928 getSourceDocument(const XalanDOMString& theURI) const = 0; 01929 01930 virtual void 01931 setSourceDocument( 01932 const XalanDOMString& theURI, 01933 XalanDocument* theDocument) = 0; 01934 01935 01936 virtual const XalanDecimalFormatSymbols* 01937 getDecimalFormatSymbols(const XalanQName& qname) = 0; 01938 01939 // These interfaces are inherited from ExecutionContext... 01940 01941 virtual void 01942 error( 01943 const XalanDOMString& msg, 01944 const XalanNode* sourceNode, 01945 const LocatorType* locator) const = 0; 01946 01947 virtual void 01948 error( 01949 const char* msg, 01950 const XalanNode* sourceNode, 01951 const LocatorType* locator) const = 0; 01952 01953 virtual void 01954 warn( 01955 const XalanDOMString& msg, 01956 const XalanNode* sourceNode = 0, 01957 const LocatorType* locator = 0) const = 0; 01958 01959 virtual void 01960 warn( 01961 const char* msg, 01962 const XalanNode* sourceNode = 0, 01963 const LocatorType* locator = 0) const = 0; 01964 01965 virtual void 01966 message( 01967 const XalanDOMString& msg, 01968 const XalanNode* sourceNode = 0, 01969 const LocatorType* locator = 0) const = 0; 01970 01971 virtual void 01972 message( 01973 const char* msg, 01974 const XalanNode* sourceNode = 0, 01975 const LocatorType* locator = 0) const = 0; 01976 01977 protected: 01978 01984 virtual FormatterToText* 01985 borrowFormatterToText() = 0; 01986 01993 virtual bool 01994 returnFormatterToText(FormatterToText* theFormatter) = 0; 01995 }; 01996 01997 01998 01999 XALAN_CPP_NAMESPACE_END 02000 02001 02002 02003 #endif // STYLESHEETEXECUTIONCONTEXT_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSLT Processor Version 1.6 |
|