#include "MiniEngine_Xml.h" #include "rapidxml/rapidxml_print.hpp" #include "rapidxml/rapidxml_utils.hpp" #include namespace MiniEngine { namespace XML { Document::Document() { _is_ready=false; } Document::Document(const std::string& filename) { if(loadFrom(filename,false)!=0) { _is_ready=false; } else { _is_ready=true; } } int Document::loadFrom(const std::string& filename, bool clearCurrent) { std::ifstream ifs(filename); if(!ifs) { /// File Read Error. return -1; } rapidxml::file<> infilereader(ifs); if(clearCurrent) { _doc.clear(); } _doc.parse<0>(infilereader.data()); return 0; } int Document::saveTo(const std::string& filename) { std::string ans; rapidxml::print(std::back_inserter(ans),_doc,0); std::ofstream ofs(filename); if(!ofs) return -1; ofs<