00001 /* 00002 * Copyright 2002-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 * imitations under the License. 00015 */ 00016 00017 /* 00018 * XSEC 00019 * 00020 * TXFMXSL := Class that performs XML Stylesheet Language transforms 00021 * 00022 * $Id: TXFMXSL.hpp,v 1.11 2004/02/08 10:25:16 blautenb Exp $ 00023 * 00024 */ 00025 00026 #include <xsec/transformers/TXFMBase.hpp> 00027 00028 // Xerces 00029 00030 #include <xercesc/dom/DOM.hpp> 00031 00032 // Xalan 00033 00034 #ifndef XSEC_NO_XPATH 00035 00036 #include <xalanc/XalanDOM/XalanDocument.hpp> 00037 #include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp> 00038 #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp> 00039 #include <xalanc/XPath/NodeRefList.hpp> 00040 #include <xalanc/XPath/ElementPrefixResolverProxy.hpp> 00041 #include <xalanc/XalanTransformer/XalanTransformer.hpp> 00042 00043 // Xalan Namespace usage 00044 XALAN_USING_XALAN(XercesDOMSupport) 00045 XALAN_USING_XALAN(XercesParserLiaison) 00046 XALAN_USING_XALAN(XalanDocument) 00047 XALAN_USING_XALAN(XalanTransformer) 00048 00049 #endif 00050 00051 #ifndef XSEC_NO_XSLT 00052 00058 class DSIG_EXPORT TXFMXSL : public TXFMBase { 00059 00060 private: 00061 00062 safeBuffer expr; // The expression being worked with 00063 00064 XercesDOMSupport xds; 00065 XercesParserLiaison xpl; 00066 00067 XalanDocument * xd; 00068 00069 safeBuffer sbInDoc; 00070 00071 XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument 00072 * document; 00073 00074 XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument 00075 * docOut; // The output from the transformation 00076 00077 public: 00078 00079 TXFMXSL(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc); 00080 ~TXFMXSL(); 00081 00082 // Methods to set the inputs 00083 00084 void setInput(TXFMBase *newInput); 00085 00086 // Methods to get tranform output type and input requirement 00087 00088 virtual TXFMBase::ioType getInputType(void); 00089 virtual TXFMBase::ioType getOutputType(void); 00090 virtual nodeType getNodeType(void); 00091 00092 // We do our own name spaces - we have a new document! 00093 00094 virtual bool nameSpacesExpanded(void); 00095 virtual void expandNameSpaces(void); 00096 00097 00098 // XSL Unique 00099 00100 void evaluateStyleSheet(const safeBuffer &sbStyleSheet); 00101 00102 // Methods to get output data 00103 00104 virtual unsigned int readBytes(XMLByte * const toFill, const unsigned int maxToFill); 00105 virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *getDocument(); 00106 virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getFragmentNode(); 00107 virtual const XMLCh * getFragmentId(); 00108 00109 private: 00110 TXFMXSL(); 00111 00112 }; 00113 00114 00115 #endif /* No XSLT */