00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 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(XALANTRANSFORMER_HEADER_GUARD) 00058 #define XALANTRANSFORMER_HEADER_GUARD 00059 00060 00061 00062 // Base include file. Must be first. 00063 #include <XalanTransformer/XalanTransformerDefinitions.hpp> 00064 00065 00066 00067 #include <vector> 00068 00069 00070 00071 #include <XPath/XalanQNameByValue.hpp> 00072 00073 00074 00075 #include <XSLT/XSLTInputSource.hpp> 00076 #include <XSLT/XSLTResultTarget.hpp> 00077 00078 00079 00080 class EntityResolver; 00081 class ErrorHandler; 00082 class Function; 00083 class StylesheetExecutionContextDefault; 00084 class XSLTInit; 00085 class XalanDocumentBuilder; 00086 class XalanCompiledStylesheet; 00087 class XalanParsedSource; 00088 class XalanTransformerOutputStream; 00089 00090 00091 00098 class XALAN_TRANSFORMER_EXPORT XalanTransformer 00099 { 00100 public: 00101 00102 XalanTransformer(); 00103 00104 virtual 00105 ~XalanTransformer(); 00106 00112 static void 00113 initialize(); 00114 00120 static void 00121 terminate(); 00122 00132 int 00133 transform( 00134 const XalanParsedSource& theParsedXML, 00135 const XSLTInputSource& theStylesheetSource, 00136 const XSLTResultTarget& theResultTarget); 00137 00147 int 00148 transform( 00149 const XalanParsedSource& theParsedXML, 00150 const XalanCompiledStylesheet* theCompiledStylesheet, 00151 const XSLTResultTarget& theResultTarget); 00152 00164 int 00165 transform( 00166 const XSLTInputSource& theInputSource, 00167 const XSLTInputSource& theStylesheetSource, 00168 const XSLTResultTarget& theResultTarget); 00169 00180 int 00181 transform( 00182 const XSLTInputSource& theInputSource, 00183 const XSLTResultTarget& theResultTarget); 00184 00203 int 00204 transform( 00205 const XSLTInputSource& theInputSource, 00206 const XSLTInputSource& theStylesheetSource, 00207 void* theOutputHandle, 00208 XalanOutputHandlerType theOutputHandler, 00209 XalanFlushHandlerType theFlushHandler = 0); 00210 00222 int 00223 transform( 00224 const XSLTInputSource& theInputSource, 00225 const XalanCompiledStylesheet* theCompiledStylesheet, 00226 const XSLTResultTarget& theResultTarget); 00227 00246 int 00247 transform( 00248 const XalanParsedSource& theParsedSource, 00249 const XalanCompiledStylesheet* theCompiledStylesheet, 00250 void* theOutputHandle, 00251 XalanOutputHandlerType theOutputHandler, 00252 XalanFlushHandlerType theFlushHandler = 0); 00253 00271 int 00272 transform( 00273 const XSLTInputSource& theInputSource, 00274 void* theOutputHandle, 00275 XalanOutputHandlerType theOutputHandler, 00276 XalanFlushHandlerType theFlushHandler = 0); 00277 00290 int 00291 compileStylesheet( 00292 const XSLTInputSource& theStylesheetSource, 00293 const XalanCompiledStylesheet*& theCompiledStylesheet); 00294 00302 int 00303 destroyStylesheet(const XalanCompiledStylesheet* theStylesheet); 00304 00318 int 00319 parseSource( 00320 const XSLTInputSource& theInputSource, 00321 const XalanParsedSource*& theParsedSource, 00322 bool useXercesDOM = false); 00323 00330 int 00331 destroyParsedSource(const XalanParsedSource* theParsedSource); 00332 00342 XalanDocumentBuilder* 00343 createDocumentBuilder(); 00344 00352 void 00353 destroyDocumentBuilder(XalanDocumentBuilder* theDocumentBuilder); 00354 00362 void 00363 installExternalFunction( 00364 const XalanDOMString& theNamespace, 00365 const XalanDOMString& functionName, 00366 const Function& function); 00367 00375 static void 00376 installExternalFunctionGlobal( 00377 const XalanDOMString& theNamespace, 00378 const XalanDOMString& functionName, 00379 const Function& function); 00380 00387 void 00388 uninstallExternalFunction( 00389 const XalanDOMString& theNamespace, 00390 const XalanDOMString& functionName); 00391 00398 static void 00399 uninstallExternalFunctionGlobal( 00400 const XalanDOMString& theNamespace, 00401 const XalanDOMString& functionName); 00402 00410 void 00411 setStylesheetParam( 00412 const XalanDOMString& key, 00413 const XalanDOMString& expression); 00414 00422 void 00423 setStylesheetParam( 00424 const char* key, 00425 const char* expression); 00426 00433 bool 00434 getUseValidation() const 00435 { 00436 return m_useValidation; 00437 } 00438 00445 void 00446 setUseValidation(bool fValue) 00447 { 00448 m_useValidation = fValue; 00449 } 00450 00456 EntityResolver* 00457 getEntityResolver() const 00458 { 00459 return m_entityResolver; 00460 } 00461 00471 void 00472 setEntityResolver(EntityResolver* theResolver) 00473 { 00474 m_entityResolver = theResolver; 00475 } 00476 00482 ErrorHandler* 00483 getErrorHandler() const 00484 { 00485 return m_errorHandler; 00486 } 00487 00493 void 00494 setErrorHandler(ErrorHandler* theErrorHandler) 00495 { 00496 m_errorHandler = theErrorHandler; 00497 } 00498 00505 const char* 00506 getLastError() const; 00507 00513 int 00514 getIndent() const; 00515 00521 void 00522 setIndent(int indentAmount); 00523 00524 #if defined(XALAN_NO_NAMESPACES) 00525 typedef vector<const XalanCompiledStylesheet*> CompiledStylesheetPtrVectorType; 00526 typedef vector<const XalanParsedSource*> ParsedSourcePtrVectorType; 00527 typedef pair<XalanDOMString, XalanDOMString> ParamPairType; 00528 typedef vector<ParamPairType> ParamPairVectorType; 00529 typedef pair<XalanQNameByValue, Function*> FunctionPairType; 00530 typedef vector<FunctionPairType> FunctionParamPairVectorType; 00531 #else 00532 typedef std::vector<const XalanCompiledStylesheet*> CompiledStylesheetPtrVectorType; 00533 typedef std::vector<const XalanParsedSource*> ParsedSourcePtrVectorType; 00534 typedef std::pair<XalanDOMString, XalanDOMString> ParamPairType; 00535 typedef std::vector<ParamPairType> ParamPairVectorType; 00536 typedef std::pair<XalanQNameByValue, Function*> FunctionPairType; 00537 typedef std::vector<FunctionPairType> FunctionParamPairVectorType; 00538 #endif 00539 00540 class EnsureDestroyParsedSource 00541 { 00542 public: 00543 00544 EnsureDestroyParsedSource( 00545 XalanTransformer& theTransformer, 00546 const XalanParsedSource* theParsedSource) : 00547 m_transformer(theTransformer), 00548 m_parsedSource(theParsedSource) 00549 { 00550 } 00551 00552 ~EnsureDestroyParsedSource() 00553 { 00554 m_transformer.destroyParsedSource(m_parsedSource); 00555 } 00556 00557 private: 00558 00559 XalanTransformer& m_transformer; 00560 00561 const XalanParsedSource* const m_parsedSource; 00562 }; 00563 00564 struct EnsureDestroyCompiledStylesheet 00565 { 00566 EnsureDestroyCompiledStylesheet( 00567 XalanTransformer& theTransformer, 00568 const XalanCompiledStylesheet* theCompiledStylesheet) : 00569 m_transformer(theTransformer), 00570 m_compiledStylesheet(theCompiledStylesheet) 00571 { 00572 } 00573 00574 ~EnsureDestroyCompiledStylesheet() 00575 { 00576 m_transformer.destroyStylesheet(m_compiledStylesheet); 00577 } 00578 00579 private: 00580 00581 XalanTransformer& m_transformer; 00582 00583 const XalanCompiledStylesheet* const m_compiledStylesheet; 00584 }; 00585 00586 struct EnsureDestroyDocumentBuilder 00587 { 00588 EnsureDestroyDocumentBuilder( 00589 XalanTransformer& theTransformer, 00590 XalanDocumentBuilder* theDocumentBuilder) : 00591 m_transformer(theTransformer), 00592 m_documentBuilder(theDocumentBuilder) 00593 { 00594 } 00595 00596 ~EnsureDestroyDocumentBuilder() 00597 { 00598 m_transformer.destroyDocumentBuilder(m_documentBuilder); 00599 } 00600 00601 private: 00602 00603 XalanTransformer& m_transformer; 00604 00605 XalanDocumentBuilder* const m_documentBuilder; 00606 }; 00607 00608 protected: 00609 00610 private: 00611 00612 void 00613 reset(); 00614 00615 class EnsureReset 00616 { 00617 public: 00618 00619 EnsureReset(XalanTransformer& theTransformer) : 00620 m_transformer(theTransformer) 00621 { 00622 } 00623 00624 ~EnsureReset(); 00625 00626 private: 00627 00628 XalanTransformer& m_transformer; 00629 }; 00630 00631 friend class EnsureReset; 00632 00633 CompiledStylesheetPtrVectorType m_compiledStylesheets; 00634 00635 ParsedSourcePtrVectorType m_parsedSources; 00636 00637 ParamPairVectorType m_paramPairs; 00638 00639 FunctionParamPairVectorType m_functionPairs; 00640 00641 CharVectorType m_errorMessage; 00642 00643 bool m_useValidation; 00644 00645 EntityResolver* m_entityResolver; 00646 00647 ErrorHandler* m_errorHandler; 00648 00649 // This should always be the latest data member!!! 00650 StylesheetExecutionContextDefault* m_stylesheetExecutionContext; 00651 00652 static const XSLTInit* s_xsltInit; 00653 }; 00654 00655 00656 00657 #endif // XALANTRANSFORMER_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 |
|