FDO API Reference | Feature Data Objects |
00001 #ifndef FDO_XSL_TRANSFORMER_H 00002 #define FDO_XSL_TRANSFORMER_H 00003 // 00004 00005 // 00006 // Copyright (C) 2004-2006 Autodesk, Inc. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of version 2.1 of the GNU Lesser 00010 // General Public License as published by the Free Software Foundation. 00011 // 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 // Lesser General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public 00018 // License along with this library; if not, write to the Free Software 00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 // 00021 00022 #include <FdoCommon.h> 00023 00024 /// \brief 00025 /// FdoXslTransformer provides a way to execute an XSL stylesheet 00026 /// on an XML document. 00027 class FdoXslTransformer : public FdoDisposable 00028 { 00029 public: 00030 00031 /// \brief 00032 /// Constructs an XSL Transformer object. 00033 /// 00034 /// \param inDoc 00035 /// Input the XML document to transform. 00036 /// \param stylesheet 00037 /// Input the XSL stylesheet with transformation instructions. 00038 /// \param outDoc 00039 /// Output the transformed XML document. 00040 /// \warning 00041 /// The transformed document is not completely written until 'outDoc' 00042 /// and this transformer are destroyed by releasing all references to them. 00043 /// Therefore, these objects must be destroyed before reading back the 00044 /// transformed document. 00045 /// \param log 00046 /// Input the logging object which captures messages and warnings. 00047 /// 00048 /// \return 00049 /// Returns FdoXslTransformer 00050 /// 00051 FDO_API_COMMON static FdoXslTransformer* Create( 00052 FdoXmlReader* inDoc = NULL, 00053 FdoXmlReader* stylesheet = NULL, 00054 FdoXmlWriter* outDoc = NULL, 00055 FdoIoTextWriter* log = NULL 00056 ); 00057 00058 /// \brief 00059 /// Gets the document being transformed 00060 /// 00061 /// \return 00062 /// Returns the input document. 00063 /// 00064 FDO_API_COMMON FdoXmlReader* GetInDoc(); 00065 00066 /// \brief 00067 /// Sets the document to transform. 00068 /// 00069 /// \param inDoc 00070 /// Input the XML document to transform. 00071 /// 00072 FDO_API_COMMON void SetInDoc( FdoXmlReader* inDoc ); 00073 00074 /// \brief 00075 /// Gets the XSL Stylesheet 00076 /// 00077 /// \return 00078 /// Returns the stylesheet. 00079 /// 00080 FDO_API_COMMON FdoXmlReader* GetStylesheet(); 00081 00082 /// \brief 00083 /// Sets the XSL stylesheet 00084 /// 00085 /// \param stylesheet 00086 /// Input the stylesheet 00087 /// 00088 FDO_API_COMMON void SetStylesheet( FdoXmlReader* stylesheet ); 00089 00090 /// \brief 00091 /// Gets the output document. 00092 /// 00093 /// \return 00094 /// Returns the out document 00095 /// 00096 FDO_API_COMMON FdoXmlWriter* GetOutDoc(); 00097 00098 /// \brief 00099 /// Sets the output document 00100 /// 00101 /// \param outDoc 00102 /// Input the output document 00103 /// \warning 00104 /// The output document is not completely written until outDoc 00105 /// and this transformer are destroyed by releasing all references to them. 00106 /// 00107 FDO_API_COMMON void SetOutDoc( FdoXmlWriter* outDoc ); 00108 00109 /// \brief 00110 /// Gets the logging object 00111 /// 00112 /// \return 00113 /// Returns the logging object 00114 /// 00115 FDO_API_COMMON FdoIoTextWriter* GetLog(); 00116 00117 /// \brief 00118 /// Sets the logging object 00119 /// 00120 /// \param log 00121 /// The logging object which captures messages and warnings. 00122 /// 00123 FDO_API_COMMON void SetLog( FdoIoTextWriter* log ); 00124 00125 /// \brief 00126 /// Gets the list of parameters that will be passed to the 00127 /// stylesheet by Transform(). The caller can add parameters to this list 00128 /// or modify/delete existing parameters. The parameter list is empty 00129 /// when this class is constructed. 00130 /// Parameter values must be in XPath syntax. Therefore, literal values 00131 /// must be enclosed in single quotes. 00132 /// 00133 /// \return 00134 /// Returns the parameter list. 00135 /// 00136 FDO_API_COMMON FdoDictionary* GetParameters(); 00137 00138 /// \brief 00139 /// Performs the transformation. 00140 /// 00141 FDO_API_COMMON virtual void Transform() = 0; 00142 00143 protected: 00144 /// \cond DOXYGEN-IGNORE 00145 FdoXslTransformer( 00146 FdoXmlReader* inDoc = NULL, 00147 FdoXmlReader* stylesheet = NULL, 00148 FdoXmlWriter* outDoc = NULL, 00149 FdoIoTextWriter* log = NULL 00150 ); 00151 00152 virtual ~FdoXslTransformer(void) {} 00153 /// \endcond 00154 00155 private: 00156 /// in document 00157 FdoXmlReaderP mInDoc; 00158 /// stylesheet 00159 FdoXmlReaderP mStylesheet; 00160 /// out document 00161 FdoXmlWriterP mOutDoc; 00162 /// stylesheet parameters 00163 FdoDictionaryP mParameters; 00164 /// Logger 00165 FdoIoTextWriterP mLog; 00166 }; 00167 00168 /// \brief 00169 /// FdoXslTransformerP is a FdoPtr on FdoXslTransformer, provided for convenience. 00170 typedef FdoPtr<FdoXslTransformer> FdoXslTransformerP; 00171 00172 #endif 00173 00174
Comments or suggestions? Send us feedback. |