diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/createdomdocument.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/createdomdocument.h
index bc7772436d8bc2b82967cd4b747fe7fdba93c7fb..66889180426d52f8d9edac24b37b92c3214389fe 100644
--- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/createdomdocument.h
+++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/createdomdocument.h
@@ -8,9 +8,6 @@
 #include <xercesc/dom/DOMLSParser.hpp>
 #include <iostream>
 
-using namespace std;
-using namespace xercesc;
-
-DOMDocument *createDOMDocument(string xmlFile, DOMLSParser *parser, unsigned int flags = 0);
+xercesc::DOMDocument *createDOMDocument(std::string xmlFile, xercesc::DOMLSParser *parser, unsigned int flags = 0);
 
 #endif // CREATEDOMDOCUMENT_H
diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx
index a6f28adb549d7080cb6781b942c2f3bedf76f89c..2e03038f570423eddc01e1c217a81c62bf0d3d33 100644
--- a/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx
+++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx
@@ -28,6 +28,7 @@
 #include "GeoModelXml/MaterialManager.h"
 
 using namespace std;
+using namespace xercesc;
 
 Gmx2Geo::Gmx2Geo(const string xmlFile, GeoPhysVol *addHere, GmxInterface &gmxInterface, unsigned int flags, bool useMatManager) {
 //
diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolProcessor.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolProcessor.cxx
index 80fa1e59ada0a94743702b89fa9e01231e2ea9ef..be91d1ea82cddfc983f49df9496d7f9a610cd8dd 100644
--- a/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolProcessor.cxx
+++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolProcessor.cxx
@@ -65,10 +65,11 @@ GeoNameTag *physVolName;
         // Check it is a shape... its parent should be a <shapes>. DTD cannot do this for us.
         DOMNode *parent = refShape->getParentNode();
         if (XMLString::compareIString(parent->getNodeName(), XMLString::transcode("shapes")) != 0) {
-
+            char* shape_s = XMLString::transcode (shape);
             msglog << MSG::FATAL << "Processing logvol " << name <<
                     ". Error in gmx file. An IDREF for a logvol shape did not refer to a shape.\n" <<
-                    "Shape ref was " << shape << "; exiting" << endmsg;
+                    "Shape ref was " << shape_s << "; exiting" << endmsg;
+	    XMLString::release (&shape_s);
             exit (1); // Need to improve...
         }
 //
@@ -90,10 +91,12 @@ GeoNameTag *physVolName;
         parent = refMaterial->getParentNode();
         XMLCh * materials_tmp = XMLString::transcode("materials");
         if (XMLString::compareIString(parent->getNodeName(), materials_tmp) != 0) {
-            msglog << MSG::FATAL << "Processing logvol " << name <<
+	  char* material_s = XMLString::transcode (material);
+	  msglog << MSG::FATAL << "Processing logvol " << name <<
                     ". Error in gmx file. An IDREF for a logvol material did not refer to a material.\n" <<
-                    "Material ref was " << material << "; exiting" << endmsg;
-            exit (1); // Need to improve...
+                    "Material ref was " << material_s << "; exiting" << endmsg;
+	  XMLString::release (&material_s);
+	  exit (1); // Need to improve...
         }
 	std::string nam_mat=XMLString::transcode(material);
 
diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeShaperef.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeShaperef.cxx
index 4f7621903d96bfd1b177990ce89058be881cd220..86aa0d39f8b5289602191afeb099551b99057301 100644
--- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeShaperef.cxx
+++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeShaperef.cxx
@@ -31,9 +31,11 @@ const RCBase *MakeShaperef::process(const DOMElement *element, GmxUtil &gmxUtil)
 //
     DOMNode *parent = shape->getParentNode();
     if (XMLString::compareIString(parent->getNodeName(), shapes_tmp) != 0) {
-        msglog << MSG::FATAL << "Error processing <shaperef> tag: An IDREF for a shape did not refer to a shape.\nShape ref was " << 
-               idref << "; exiting" << endmsg;
-        exit (1); // Need to improve...
+      char* idref_s = XMLString::transcode (idref);
+      msglog << MSG::FATAL << "Error processing <shaperef> tag: An IDREF for a shape did not refer to a shape.\nShape ref was " << 
+               idref_s << "; exiting" << endmsg;
+      XMLString::release (&idref_s);
+      exit (1); // Need to improve...
     }
 //
 //    Get what sort of shape