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/StylesheetExecutionContextDefault.hpp> 00076 #include <XSLT/XSLTInputSource.hpp> 00077 #include <XSLT/XSLTResultTarget.hpp> 00078 00079 00080 00081 #include <XalanTransformer/XalanTransformerOutputStream.hpp> 00082 00083 00084 00085 class Function; 00086 class XSLTInit; 00087 class XalanDocumentBuilder; 00088 class XalanCompiledStylesheet; 00089 class XalanParsedSource; 00090 class XalanTransformerOutputStream; 00091 00092 00093 00100 class XALAN_TRANSFORMER_EXPORT XalanTransformer 00101 { 00102 public: 00103 00104 XalanTransformer(); 00105 00106 virtual 00107 ~XalanTransformer(); 00108 00114 static void 00115 initialize(); 00116 00122 static void 00123 terminate(); 00124 00134 int 00135 transform( 00136 const XalanParsedSource& theParsedXML, 00137 const XSLTInputSource& theStylesheetSource, 00138 const XSLTResultTarget& theResultTarget); 00139 00149 int 00150 transform( 00151 const XalanParsedSource& theParsedXML, 00152 const XalanCompiledStylesheet* theCompiledStylesheet, 00153 const XSLTResultTarget& theResultTarget); 00154 00166 int 00167 transform( 00168 const XSLTInputSource& theInputSource, 00169 const XSLTInputSource& theStylesheetSource, 00170 const XSLTResultTarget& theResultTarget); 00171 00182 int 00183 transform( 00184 const XSLTInputSource& theInputSource, 00185 const XSLTResultTarget& theResultTarget); 00186 00205 int 00206 transform( 00207 const XSLTInputSource& theInputSource, 00208 const XSLTInputSource& theStylesheetSource, 00209 void* theOutputHandle, 00210 XalanOutputHandlerType theOutputHandler, 00211 XalanFlushHandlerType theFlushHandler = 0); 00212 00224 int 00225 transform( 00226 const XSLTInputSource& theInputSource, 00227 const XalanCompiledStylesheet* theCompiledStylesheet, 00228 const XSLTResultTarget& theResultTarget); 00229 00248 int 00249 transform( 00250 const XalanParsedSource& theParsedSource, 00251 const XalanCompiledStylesheet* theCompiledStylesheet, 00252 void* theOutputHandle, 00253 XalanOutputHandlerType theOutputHandler, 00254 XalanFlushHandlerType theFlushHandler = 0); 00255 00273 int 00274 transform( 00275 const XSLTInputSource& theInputSource, 00276 void* theOutputHandle, 00277 XalanOutputHandlerType theOutputHandler, 00278 XalanFlushHandlerType theFlushHandler = 0); 00279 00292 int 00293 compileStylesheet( 00294 const XSLTInputSource& theStylesheetSource, 00295 const XalanCompiledStylesheet*& theCompiledStylesheet); 00296 00304 int 00305 destroyStylesheet(const XalanCompiledStylesheet* theStylesheet); 00306 00320 int 00321 parseSource( 00322 const XSLTInputSource& theInputSource, 00323 const XalanParsedSource*& theParsedSource, 00324 bool useXercesDOM = false); 00325 00332 int 00333 destroyParsedSource(const XalanParsedSource* theParsedSource); 00334 00344 XalanDocumentBuilder* 00345 createDocumentBuilder(); 00346 00354 void 00355 destroyDocumentBuilder(XalanDocumentBuilder* theDocumentBuilder); 00356 00364 void 00365 installExternalFunction( 00366 const XalanDOMString& theNamespace, 00367 const XalanDOMString& functionName, 00368 const Function& function); 00369 00377 static void 00378 installExternalFunctionGlobal( 00379 const XalanDOMString& theNamespace, 00380 const XalanDOMString& functionName, 00381 const Function& function); 00382 00389 void 00390 uninstallExternalFunction( 00391 const XalanDOMString& theNamespace, 00392 const XalanDOMString& functionName); 00393 00400 static void 00401 uninstallExternalFunctionGlobal( 00402 const XalanDOMString& theNamespace, 00403 const XalanDOMString& functionName); 00404 00412 void 00413 setStylesheetParam( 00414 const XalanDOMString& key, 00415 const XalanDOMString& expression); 00416 00423 const char* 00424 getLastError() const; 00425 00426 00427 #if defined(XALAN_NO_NAMESPACES) 00428 typedef vector<const XalanCompiledStylesheet*> CompiledStylesheetPtrVectorType; 00429 typedef vector<const XalanParsedSource*> ParsedSourcePtrVectorType; 00430 typedef pair<XalanDOMString, XalanDOMString> ParamPairType; 00431 typedef vector<ParamPairType> ParamPairVectorType; 00432 typedef pair<XalanQNameByValue, Function*> FunctionPairType; 00433 typedef vector<FunctionPairType> FunctionParamPairVectorType; 00434 #else 00435 typedef std::vector<const XalanCompiledStylesheet*> CompiledStylesheetPtrVectorType; 00436 typedef std::vector<const XalanParsedSource*> ParsedSourcePtrVectorType; 00437 typedef std::pair<XalanDOMString, XalanDOMString> ParamPairType; 00438 typedef std::vector<ParamPairType> ParamPairVectorType; 00439 typedef std::pair<XalanQNameByValue, Function*> FunctionPairType; 00440 typedef std::vector<FunctionPairType> FunctionParamPairVectorType; 00441 #endif 00442 00443 class EnsureDestroyParsedSource 00444 { 00445 public: 00446 00447 EnsureDestroyParsedSource( 00448 XalanTransformer& theTransformer, 00449 const XalanParsedSource* theParsedSource) : 00450 m_transformer(theTransformer), 00451 m_parsedSource(theParsedSource) 00452 { 00453 } 00454 00455 ~EnsureDestroyParsedSource() 00456 { 00457 m_transformer.destroyParsedSource(m_parsedSource); 00458 } 00459 00460 private: 00461 00462 XalanTransformer& m_transformer; 00463 00464 const XalanParsedSource* const m_parsedSource; 00465 }; 00466 00467 struct EnsureDestroyCompiledStylesheet 00468 { 00469 EnsureDestroyCompiledStylesheet( 00470 XalanTransformer& theTransformer, 00471 const XalanCompiledStylesheet* theCompiledStylesheet) : 00472 m_transformer(theTransformer), 00473 m_compiledStylesheet(theCompiledStylesheet) 00474 { 00475 } 00476 00477 ~EnsureDestroyCompiledStylesheet() 00478 { 00479 m_transformer.destroyStylesheet(m_compiledStylesheet); 00480 } 00481 00482 private: 00483 00484 XalanTransformer& m_transformer; 00485 00486 const XalanCompiledStylesheet* const m_compiledStylesheet; 00487 }; 00488 00489 struct EnsureDestroyDocumentBuilder 00490 { 00491 EnsureDestroyDocumentBuilder( 00492 XalanTransformer& theTransformer, 00493 XalanDocumentBuilder* theDocumentBuilder) : 00494 m_transformer(theTransformer), 00495 m_documentBuilder(theDocumentBuilder) 00496 { 00497 } 00498 00499 ~EnsureDestroyDocumentBuilder() 00500 { 00501 m_transformer.destroyDocumentBuilder(m_documentBuilder); 00502 } 00503 00504 private: 00505 00506 XalanTransformer& m_transformer; 00507 00508 XalanDocumentBuilder* const m_documentBuilder; 00509 }; 00510 00511 protected: 00512 00513 private: 00514 00515 void 00516 reset(); 00517 00518 class EnsureReset 00519 { 00520 public: 00521 00522 EnsureReset(XalanTransformer& theTransformer) : 00523 m_transformer(theTransformer) 00524 { 00525 } 00526 00527 ~EnsureReset(); 00528 00529 private: 00530 00531 XalanTransformer& m_transformer; 00532 }; 00533 00534 friend class EnsureReset; 00535 00536 StylesheetExecutionContextDefault m_stylesheetExecutionContext; 00537 00538 CompiledStylesheetPtrVectorType m_compiledStylesheets; 00539 00540 ParsedSourcePtrVectorType m_parsedSources; 00541 00542 ParamPairVectorType m_paramPairs; 00543 00544 FunctionParamPairVectorType m_functionPairs; 00545 00546 CharVectorType m_errorMessage; 00547 00548 static XSLTInit* s_xsltInit; 00549 }; 00550 00551 #endif // XALANTRANSFORMER_HEADER_GUARD 00552 00553 00554
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSL Transformer Version 1.1 |
|