| 19 | using namespace base; |
| 20 | |
| 21 | XmlDocumentRef open_xml(const std::string& filename) |
| 22 | { |
| 23 | FileHandle file(open_file(filename, "rb")); |
| 24 | if (!file) |
| 25 | throw Exception("Error loading file: " + filename); |
| 26 | |
| 27 | // Try to load the XML file |
| 28 | XmlDocumentRef doc(new tinyxml2::XMLDocument()); |
| 29 | doc->SetValue(filename.c_str()); |
| 30 | if (doc->LoadFile(file.get()) != tinyxml2::XML_SUCCESS) |
| 31 | throw Exception(doc->ErrorStr()); |
| 32 | |
| 33 | return doc; |
| 34 | } |
| 35 | |
| 36 | void save_xml(XmlDocumentRef doc, const std::string& filename) |
| 37 | { |
no test coverage detected