diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadDetectorsGroupingFile.h b/Framework/DataHandling/inc/MantidDataHandling/LoadDetectorsGroupingFile.h index 7e13f0adf3b1a8285fad6ab47770f745e401e65c..0f7beb7498f5019982555a2e1ffc378a998f9815 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadDetectorsGroupingFile.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadDetectorsGroupingFile.h @@ -5,11 +5,12 @@ #include "MantidDataObjects/GroupingWorkspace.h" #include "MantidKernel/System.h" +#include <Poco/DOM/Document.h> + #include <fstream> namespace Poco { namespace XML { -class Document; class Element; class Node; } // namespace XML @@ -166,9 +167,7 @@ private: bool m_userGiveDescription; /// XML document loaded - Poco::XML::Document *m_pDoc; - /// Root element of the parsed XML - Poco::XML::Element *m_pRootElem; + Poco::AutoPtr<Poco::XML::Document> m_pDoc; /// Data structures to store XML to Group/Detector conversion map std::map<int, std::vector<std::string>> m_groupComponentsMap; std::map<int, std::vector<detid_t>> m_groupDetectorsMap; diff --git a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp index 08f568341fd6c799ddbb91933dba1e5e88c26c5b..e8e427493397179ebf3baca3a072486fe1b342f3 100644 --- a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp +++ b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp @@ -14,7 +14,6 @@ #include "MantidKernel/System.h" #include <Poco/DOM/DOMParser.h> -#include <Poco/DOM/Document.h> #include <Poco/DOM/Element.h> #include <Poco/DOM/NamedNodeMap.h> #include <Poco/DOM/NodeFilter.h> @@ -381,9 +380,8 @@ void LoadDetectorsGroupingFile::generateNoInstrumentGroupWorkspace() { LoadGroupXMLFile::LoadGroupXMLFile() : m_instrumentName(""), m_userGiveInstrument(false), m_date(""), m_userGiveDate(false), m_description(""), m_userGiveDescription(false), - m_pDoc(nullptr), m_pRootElem(nullptr), m_groupComponentsMap(), - m_groupDetectorsMap(), m_groupSpectraMap(), m_startGroupID(1), - m_groupNamesMap() {} + m_pDoc(), m_groupComponentsMap(), m_groupDetectorsMap(), + m_groupSpectraMap(), m_startGroupID(1), m_groupNamesMap() {} void LoadGroupXMLFile::loadXMLFile(std::string xmlfilename) { @@ -407,9 +405,7 @@ void LoadGroupXMLFile::initializeXMLParser(const std::string &filename) { } catch (...) { throw Kernel::Exception::FileError("Unable to parse File:", filename); } - // Get pointer to root element - m_pRootElem = m_pDoc->documentElement(); - if (!m_pRootElem->hasChildNodes()) { + if (!m_pDoc->documentElement()->hasChildNodes()) { throw Kernel::Exception::InstrumentDefinitionError( "No root element in XML instrument file", filename); }