Main Page   Namespace List   File List   Examples  

XSLTrans.hpp

Go to the documentation of this file.
00001 /*
00002  * (C) Copyright 2002-2003, Schlund+Partner AG
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018 
00031 #ifndef SP_GXML_XSLTRANS_HPP
00032 #define SP_GXML_XSLTRANS_HPP
00033 
00034 // STDC++
00035 #include <string>
00036 
00037 // C++ Libraries
00038 #include <sp-gxmlcpp/XMLDump.hpp>
00039 #include <sp-gxmlcpp/XMLTree.hpp>
00040 
00041 // C libraries
00042 #include <libxml/xpath.h>
00043 #include <libxml/tree.h>
00044 #include <libxslt/xsltInternals.h>
00045 
00046 namespace SP {
00047 namespace GXML {
00048 
00049 class XSLTrans
00050 {
00051 public:
00052         enum Exceptions
00053         {
00054                 PARSE_ERR=1,  // Stylesheet not parsed (not well formed XML)
00055                 STYLE_ERR,    // Not a valid stylesheet
00056                 TRANS_ERR     // Transforming error
00057         };
00058 
00059         XSLTrans(const char * xmlBuffer, int size=-1, const std::string & baseURI="");
00060         XSLTrans(const std::string & xmlString, const std::string & baseURI="");
00061         XSLTrans(std::ifstream & f, const std::string & baseURI="");
00062 
00063         ~XSLTrans();
00064 
00065         xsltStylesheetPtr getStylesheetPtr();
00066 
00067         // Trans into XMLTree
00068         std::auto_ptr<XMLTree> transToXMLTree(const xmlDocPtr doc) const;
00069 
00070         std::auto_ptr<XMLDump> trans(const xmlDocPtr doc) const;
00071         std::auto_ptr<XMLDump> trans(const XMLTree * xmlTree) const;
00072         std::auto_ptr<XMLDump> trans(const std::string & xmlString) const;
00073 
00074 private:
00075         xmlDocPtr doc_;
00076         xsltStylesheetPtr style_;
00077 
00078         void genTrans(const char * xmlBuffer, int size=-1, const std::string & baseURI="");
00079 
00080         static char * defaultEncoding_;
00081 };
00082 
00083 }}
00084 #endif

Generated on Thu Jun 3 19:20:12 2004 for sp-gxmlcpp by doxygen1.2.15