Main Page   Namespace List   File List   Examples  

XMLDump.hpp

Go to the documentation of this file.
00001 /*
00002  * (C) Copyright 2002, 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 
00033 #ifndef SP_GXML_XMLDUMP_HPP
00034 #define SP_GXML_XMLDUMP_HPP
00035 
00036 // STDC++
00037 #include <string>
00038 
00039 // C libraries
00040 #include <libxslt/xsltInternals.h>
00041 #include <libxml/parser.h>
00042 #include <libxml/xpath.h>
00043 #include <libxml/tree.h>
00044 #include <libxslt/transform.h>
00045 #include <libxslt/xsltutils.h>
00046 #include <libxslt/imports.h>
00047 
00048 // Local
00049 #include <sp-gxmlcpp/Util.hpp>
00050 #include <sp-gxmlcpp/XMLTree.hpp>
00051 
00052 namespace SP
00053 {
00054 namespace GXML
00055 {
00056 
00057 // toDo
00058 class XSLTOutputBuf
00059 {
00060 public:
00061         enum Exceptions
00062         {
00063                 MEM_ERR,             // Mem Error
00064                 RESULT_INVALID,      // Result Doc invalid (0 or no children)
00065                 STYLE_INVALID        // Style invalid (0)
00066         };
00067 
00068         XSLTOutputBuf(xmlDocPtr result, xsltStylesheetPtr style);
00069         ~XSLTOutputBuf();
00070         char * getAddr() const;
00071         int getSize() const;
00072 
00073 private:
00074         xmlCharEncodingHandlerPtr encoder_;
00075         xmlOutputBufferPtr buf_;
00076 };
00077 
00078 class XMLDump
00079 {
00080 public:
00081         enum Exceptions
00082         {
00083                 MEM_ERR,             // XML could not be parsed
00084                 NODE_NOT_FOUND_ERR   // Node could not be found from path
00085         };
00086 
00087         XMLDump(const xmlDocPtr doc, const xmlXPathContextPtr ctxt, const std::string & path="/");
00088         XMLDump(const XMLTree * tree, const std::string & path="/");
00089         XMLDump(const xmlDocPtr doc);
00090         // toDo
00091         XMLDump(const XSLTOutputBuf * buf);
00092 
00093         ~XMLDump();
00094 
00095         char * getAddr() const;
00096         std::string get() const;
00097         int getSize() const;
00098 
00099 private:
00100         xmlBufferPtr nodeDump_;           // This is used to dump XML from some path other than "/"
00101         std::pair<xmlChar *, int> docDump_;    // This is used to dump the whole XML document (path = "/").
00102         // toDo
00103         XSLTOutputBuf * xsltDump_;        // This is used when dumping was actually done outside. Currently only for XSL Transformations.
00104 
00105         // genDump: Master Create Dump Function. Must be used in Constructors only
00106         void genDump(const xmlDocPtr doc, const xmlXPathContextPtr ctxt, const std::string & path);
00107 
00108         static char * nullString_;
00109 };
00110 
00111 }}
00112 #endif

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