Index: src/Parser/unittests/Makefile.am
===================================================================
--- src/Parser/unittests/Makefile.am	(revision ccb487ddab59ad8050ce40929874510f2d9454f0)
+++ src/Parser/unittests/Makefile.am	(revision d2596bcb8a99e3a32ebcb51e123bd7fed8235a16)
@@ -11,4 +11,5 @@
 	../Parser/unittests/ParserTremoloUnitTest.cpp \
 	../Parser/unittests/ParserTremolo_ElementKeysUnitTest.cpp \
+	../Parser/unittests/ParserXmlUnitTest.cpp \
 	../Parser/unittests/ParserXyzUnitTest.cpp
 
@@ -20,4 +21,5 @@
 	../Parser/unittests/ParserTremoloUnitTest.hpp \
 	../Parser/unittests/ParserTremolo_ElementKeysUnitTest.hpp \
+	../Parser/unittests/ParserXmlUnitTest.hpp \
 	../Parser/unittests/ParserXyzUnitTest.hpp
 
@@ -29,5 +31,9 @@
   ParserTremoloUnitTest \
   ParserTremolo_ElementKeysUnitTest \
+  ParserXmlUnitTest \
   ParserXyzUnitTest
+
+XFAIL_TESTS += \
+	ParserXmlUnitTest 
 
 TESTS += $(PARSERTESTS)
@@ -72,4 +78,9 @@
 ParserTremolo_ElementKeysUnitTest_LDADD = ${PARSERLIBS}
 
+ParserXmlUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
+	../Parser/unittests/ParserXmlUnitTest.cpp \
+	../Parser/unittests/ParserXmlUnitTest.hpp
+ParserXmlUnitTest_LDADD = ${PARSERLIBS}
+
 ParserXyzUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
 	../Parser/unittests/ParserXyzUnitTest.cpp \
Index: src/Parser/unittests/ParserXmlUnitTest.cpp
===================================================================
--- src/Parser/unittests/ParserXmlUnitTest.cpp	(revision d2596bcb8a99e3a32ebcb51e123bd7fed8235a16)
+++ src/Parser/unittests/ParserXmlUnitTest.cpp	(revision d2596bcb8a99e3a32ebcb51e123bd7fed8235a16)
@@ -0,0 +1,116 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010-2012 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * ParserXmlUnitTest.cpp
+ *
+ *  Created on: Mar 24, 2012
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ParserXmlUnitTest.hpp"
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include "World.hpp"
+#include "Atom/atom.hpp"
+#include "Element/element.hpp"
+#include "Element/periodentafel.hpp"
+#include "CodePatterns/Log.hpp"
+#include "Descriptors/AtomTypeDescriptor.hpp"
+#include "Parser/ChangeTracker.hpp"
+#include "Parser/XmlParser.hpp"
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+using namespace std;
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( ParserXmlUnitTest );
+
+static string waterXml = "\
+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
+<!DOCTYPE scafacos_test SYSTEM 'scafacos_test.dtd'>\n\
+\t<scafacos_test name=\"cloud-wall\" description=\"A 3D-periodic system of two walls charges and a random cloud of charges.\" reference_method=\"ewald\" error_potential=\"1.0e-13\" error_field=\"1.0e-13\">\n\
+\t\t<configuration offset=\"0 0 0\" box_a=\"10 0 0\" box_b=\"0 10 0\" box_c=\"0 0 10\" periodicity=\"1 1 1\" epsilon=\"metallic\">\n\
+\t\t\t<particle position=\"0 0 4.5\" q=\"1\" potential=\"1.318858869367693\" field=\"0.27973426575304 -0.1382533033408908 5.200985873286221\"/>\n\
+\t\t\t<particle position=\"0 0 5.5\" q=\"1\" potential=\"1.318858869367693\" field=\"0.27973426575304 -0.1382533033408908 5.200985873286221\"/>\n\
+\t\t\t<particle position=\"0 0 6.5\" q=\"1\" potential=\"1.318858869367693\" field=\"0.27973426575304 -0.1382533033408908 5.200985873286221\"/>\n\
+\t\t</configuration>\n\
+\t</scafacos_test>\n";
+static string waterMultiXml = "\n";
+
+void ParserXmlUnitTest::setUp() {
+  World::getInstance();
+
+  parser = new FormatParser<xml>();
+
+  setVerbosity(2);
+
+  // we need hydrogens and oxygens in the following tests
+  CPPUNIT_ASSERT(World::getInstance().getPeriode()->FindElement(1) != NULL);
+  CPPUNIT_ASSERT(World::getInstance().getPeriode()->FindElement(8) != NULL);
+}
+
+void ParserXmlUnitTest::tearDown()
+{
+  delete parser;
+  ChangeTracker::purgeInstance();
+  World::purgeInstance();
+}
+
+/************************************ tests ***********************************/
+
+void ParserXmlUnitTest::readwriteXmlTest() {
+  cout << "Testing the XML parser." << endl;
+  stringstream input;
+  input << waterXml;
+  parser->load(&input);
+  input.clear();
+
+  CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
+
+  // store and parse in again
+  {
+//    std::string first;
+//    std::string second;
+    std::stringstream output;
+    std::vector<atom *> atoms = World::getInstance().getAllAtoms();
+    parser->save(&output, atoms);
+    std::cout << output.str();
+
+    {
+      delete parser;
+      parser = new FormatParser<xml>();
+      std::stringstream input(waterXml);
+      parser->load(&input);
+    }
+
+    FormatParser<xml> *parser_control = new FormatParser<xml>();
+    parser_control->load(&output);
+    CPPUNIT_ASSERT( parser->data == parser_control->data );
+    delete parser_control;
+//    // check for non-empty streams
+//    input.peek();
+//    output.peek();
+//    CPPUNIT_ASSERT(input.good() && output.good());
+//    // check equality of streams per line (for debugging)
+//    for (; std::getline(input, first) && std::getline(output, second); ) {
+//      std::cout << "Comparing '" << first << "' to '" << second << "'" << std::endl;
+//      CPPUNIT_ASSERT(first == second);
+//    }
+  }
+}
Index: src/Parser/unittests/ParserXmlUnitTest.hpp
===================================================================
--- src/Parser/unittests/ParserXmlUnitTest.hpp	(revision d2596bcb8a99e3a32ebcb51e123bd7fed8235a16)
+++ src/Parser/unittests/ParserXmlUnitTest.hpp	(revision d2596bcb8a99e3a32ebcb51e123bd7fed8235a16)
@@ -0,0 +1,36 @@
+/*
+ * ParserXmlUnitTest.hpp
+ *
+ *  Created on: Mar 24, 2012
+ *      Author: heber
+ */
+#ifndef PARSERXMLUNITTEST_HPP_
+#define PARSERXMLUNITTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Parser/XmlParser.hpp"
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <string>
+
+class ParserXmlUnitTest :  public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( ParserXmlUnitTest ) ;
+  CPPUNIT_TEST ( readwriteXmlTest );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp();
+  void tearDown();
+
+  void readwriteXmlTest();
+
+private:
+  FormatParser<xml> *parser;
+};
+
+#endif /* PARSERXMLUNITTEST_HPP_ */
