nidas  v1.2-1520
XMLWriter.h
Go to the documentation of this file.
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2 // vim: set shiftwidth=4 softtabstop=4 expandtab:
3 /*
4  ********************************************************************
5  ** NIDAS: NCAR In-situ Data Acquistion Software
6  **
7  ** 2006, Copyright University Corporation for Atmospheric Research
8  **
9  ** This program is free software; you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation; either version 2 of the License, or
12  ** (at your option) any later version.
13  **
14  ** This program is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** The LICENSE.txt file accompanying this software contains
20  ** a copy of the GNU General Public License. If it is not found,
21  ** write to the Free Software Foundation, Inc.,
22  ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  **
24  ********************************************************************
25 */
26 
27 #ifndef NIDAS_CORE_XMLWRITER_H
28 #define NIDAS_CORE_XMLWRITER_H
29 
30 #include "XMLParser.h"
31 
32 #include <string>
33 
34 namespace nidas { namespace core {
35 
39 class XMLWriter {
40 public:
41 
46 
51  virtual ~XMLWriter();
52 
61  void setDiscardDefaultContent(bool val);
62 
72  void setEntities(bool val);
73 
81  void setCanonicalForm(bool val);
82 
90  void setPrettyPrint(bool val);
91 
99  void setNormalizeCharacters(bool val);
100 
110  void setSplitCDATASections(bool val);
111 
120  void setValidation(bool val);
121 
131  void setWhitespaceInElement(bool val);
132 
140  void setXMLDeclaration(bool val);
141 
142 #if XERCES_VERSION_MAJOR < 3
143  void setFilter(xercesc::DOMWriterFilter* filter);
144 #else
145  void setFilter(xercesc::DOMLSSerializerFilter* filter);
146 #endif
147 
148  virtual void write(xercesc::DOMDocument*doc, const std::string& fileName)
150 
151 #if XERCES_VERSION_MAJOR < 3
152  virtual void writeNode(xercesc::XMLFormatTarget* const dest, const xercesc::DOMNode& node)
154 #else
155  virtual void writeNode(xercesc::DOMLSOutput* const dest, const xercesc::DOMNode& node)
157 #endif
158 
159 private:
160 
161  xercesc::DOMImplementation *_impl;
162 
163 #if XERCES_VERSION_MAJOR < 3
164  xercesc::DOMWriter *_writer;
165 #else
166  xercesc::DOMLSSerializer *_writer;
167 #endif
168 
170 
172  XMLWriter(const XMLWriter&);
173 
175  XMLWriter& operator=(const XMLWriter&);
176 
177 };
178 
179 }} // namespace nidas namespace core
180 
181 #endif
182 
virtual ~XMLWriter()
Nuke the XMLWriter.
Definition: XMLWriter.cc:56
void setNormalizeCharacters(bool val)
Normalize characters.
Definition: XMLWriter.cc:109
void setValidation(bool val)
Validation.
Definition: XMLWriter.cc:127
Exception which can be built from an xerces::XMLException, xercesc::SAXException, or xercesc::DOMExce...
Definition: XMLException.h:43
void setSplitCDATASections(bool val)
Split CDATA sections.
Definition: XMLWriter.cc:118
virtual void writeNode(xercesc::XMLFormatTarget *const dest, const xercesc::DOMNode &node)
Definition: XMLWriter.cc:146
void setCanonicalForm(bool val)
Canonicalize the output.
Definition: XMLWriter.cc:91
void setXMLDeclaration(bool val)
Include xml declaration.
Wrapper class around xerces-c DOMWriter to write XML.
Definition: XMLWriter.h:39
XMLErrorHandler _errorHandler
Definition: XMLWriter.h:169
void setWhitespaceInElement(bool val)
Whitespace in element content.
Definition: XMLWriter.cc:136
XMLWriter()
Constructor.
Definition: XMLWriter.cc:39
void setDiscardDefaultContent(bool val)
Discard default content.
Definition: XMLWriter.cc:73
void setEntities(bool val)
Control writing of entities.
Definition: XMLWriter.cc:82
void setPrettyPrint(bool val)
Format pretty-print.
Definition: XMLWriter.cc:100
xercesc::DOMImplementation * _impl
Definition: XMLWriter.h:161
Definition: IOException.h:37
virtual void write(xercesc::DOMDocument *doc, const std::string &fileName)
Definition: XMLWriter.cc:166
XMLWriter & operator=(const XMLWriter &)
No assignment.
void setFilter(xercesc::DOMWriterFilter *filter)
Definition: XMLWriter.cc:65
Definition: XMLParser.h:63
xercesc::DOMWriter * _writer
Definition: XMLWriter.h:164