libdap++  Updated for version 3.12.0
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 class XMLWriter {
43 private:
44  // Various xml writer stuff
45  xmlTextWriterPtr d_writer;
46  xmlBufferPtr d_doc_buf;
47  bool d_started;
48  bool d_ended;
49 
50  string d_doc;
51 
52  void m_cleanup() ;
53 
54 public:
55  XMLWriter(const string &pad = " ");
56  virtual ~XMLWriter();
57 
58  xmlTextWriterPtr get_writer() { return d_writer; }
59  const char *get_doc();
60  unsigned int get_doc_size();
61 };
62 
63 #endif /* XMLWRITER_H_ */