libdap++  Updated for version 3.13.1
XMLWriter.h
Go to the documentation of this file.
1 
2 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
3 // Access Protocol.
4 
5 // Copyright (c) 2010 OPeNDAP, Inc.
6 // Author: James Gallagher <jgallagher@opendap.org>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 //
22 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
23 /*
24  * XMLWriter.h
25  *
26  * Created on: Jul 28, 2010
27  * Author: jimg
28  */
29 
30 #ifndef XMLWRITER_H_
31 #define XMLWRITER_H_
32 
33 #include <libxml/encoding.h>
34 #include <libxml/xmlwriter.h>
35 
36 #include <string>
37 
38 //#include <InternalErr.h>
39 
40 //using namespace std;
41 
42 namespace libdap {
43 
44 class XMLWriter {
45 private:
46  // Various xml writer stuff
47  xmlTextWriterPtr d_writer;
48  xmlBufferPtr d_doc_buf;
49  bool d_started;
50  bool d_ended;
51 
52  std::string d_doc;
53 
54  void m_cleanup() ;
55 
56 public:
57  XMLWriter(const std::string &pad = " ");
58  virtual ~XMLWriter();
59 
60  xmlTextWriterPtr get_writer() { return d_writer; }
61  const char *get_doc();
62  unsigned int get_doc_size();
63 };
64 
65 } // namespace libdap
66 
67 #endif /* XMLWRITER_H_ */
xmlTextWriterPtr get_writer()
Definition: XMLWriter.h:60
const char * get_doc()
Definition: XMLWriter.cc:105
XMLWriter(const std::string &pad=" ")
Definition: XMLWriter.cc:45
virtual ~XMLWriter()
Definition: XMLWriter.cc:83
unsigned int get_doc_size()
Definition: XMLWriter.cc:129