//! \cond internal ReferenceDataEntry::EntryPointer readReferenceDataFile(const std::string &path) { tinyxml2::XMLDocument document; document.LoadFile(path.c_str()); if (document.Error()) { std::string errorString("Error was "); errorString += document.GetErrorStr1(); errorString += document.GetErrorStr2(); GMX_THROW(TestException("Reference data not parsed successfully: " + path + "\n." + errorString + "\n")); } XMLElementPtr rootNode = document.RootElement(); if (rootNode == nullptr) { GMX_THROW(TestException("Reference data is empty: " + path)); } if (std::strcmp(rootNode->Value(), c_RootNodeName) != 0) { GMX_THROW(TestException("Invalid root node type in " + path)); } ReferenceDataEntry::EntryPointer rootEntry(ReferenceDataEntry::createRoot()); readEntry(rootNode, rootEntry.get()); return rootEntry; }
//! \cond internal ReferenceDataEntry::EntryPointer readReferenceDataFile(const std::string &path) { XmlDocumentPointer document(xmlParseFile(path.c_str())); if (!document) { GMX_THROW(TestException("Reference data not parsed successfully: " + path)); } xmlNodePtr rootNode = xmlDocGetRootElement(document.get()); if (rootNode == NULL) { GMX_THROW(TestException("Reference data is empty: " + path)); } if (xmlStrcmp(rootNode->name, cRootNodeName) != 0) { GMX_THROW(TestException("Invalid root node type in " + path)); } ReferenceDataEntry::EntryPointer rootEntry(ReferenceDataEntry::createRoot()); readEntry(rootNode, rootEntry.get()); return move(rootEntry); }