summaryrefslogtreecommitdiffstats
path: root/include/astra/XMLDocument.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/astra/XMLDocument.h')
-rw-r--r--include/astra/XMLDocument.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/include/astra/XMLDocument.h b/include/astra/XMLDocument.h
new file mode 100644
index 0000000..dbcc679
--- /dev/null
+++ b/include/astra/XMLDocument.h
@@ -0,0 +1,101 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox").
+
+The ASTRA Toolbox is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+The ASTRA Toolbox is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
+
+-----------------------------------------------------------------------
+$Id$
+*/
+
+#ifndef _INC_ASTRA_XMLDOCUMENT
+#define _INC_ASTRA_XMLDOCUMENT
+
+#include <string>
+
+#if 1
+namespace rapidxml {
+ template<class Ch> class xml_document;
+}
+#else
+#include "rapidxml.hpp"
+#endif
+
+#include "Globals.h"
+#include "XMLNode.h"
+
+using namespace std;
+
+namespace astra {
+
+/** This class encapsulates an XML Document of the Xerces DOM Parser.
+ */
+class _AstraExport XMLDocument {
+
+public:
+
+ /** Default Constructor
+ */
+ XMLDocument();
+
+ /** Destructor
+ */
+ ~XMLDocument();
+
+ /** Construct an XML DOM tree and Document from an XML file
+ *
+ * @param sFilename Location of the XML file.
+ * @return XML Document containing the DOM tree
+ */
+ static XMLDocument* readFromFile(string sFilename);
+
+ /** Construct an empty XML DOM tree with a specific root tag.
+ *
+ * @param sRootName Element name of the root tag.
+ * @return XML Document with an empty root node
+ */
+ static XMLDocument* createDocument(string sRootName);
+
+ /** Get the rootnode of the XML document
+ *
+ * @return first XML node of the document
+ */
+ XMLNode* getRootNode();
+
+ /** Save an XML DOM tree to an XML file
+ *
+ * @param sFilename Location of the XML file.
+ */
+ void saveToFile(string sFilename);
+
+
+private:
+
+ //!< Document of rapidxml
+ rapidxml::xml_document<char>* fDOMDocument;
+
+ std::string fBuf;
+
+};
+
+} // end namespace
+
+#endif