1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-09 21:50:45 +01:00

Better error messaging

This commit is contained in:
paboyle 2017-10-25 23:50:37 +01:00
parent 66295b99aa
commit b395a312af

View File

@ -68,10 +68,10 @@ std::string XmlWriter::XmlString(void)
XmlReader::XmlReader(const char *xmlstring,string toplev) : fileName_("") XmlReader::XmlReader(const char *xmlstring,string toplev) : fileName_("")
{ {
pugi::xml_parse_result result; pugi::xml_parse_result result;
result = doc_.load_string(xmlstring); result = doc_.load_file(xmlstring);
if ( !result ) { if ( !result ) {
cerr << "XML error description: " << result.description() << "\n"; cerr << "XML error description: char * " << result.description() << " "<< xmlstring << "\n";
cerr << "XML error offset : " << result.offset << "\n"; cerr << "XML error offset : char * " << result.offset << " "<<xmlstring <<"\n";
abort(); abort();
} }
if ( toplev == std::string("") ) { if ( toplev == std::string("") ) {
@ -87,8 +87,8 @@ XmlReader::XmlReader(const string &fileName,string toplev) : fileName_(fileName)
pugi::xml_parse_result result; pugi::xml_parse_result result;
result = doc_.load_file(fileName_.c_str()); result = doc_.load_file(fileName_.c_str());
if ( !result ) { if ( !result ) {
cerr << "XML error description: " << result.description() << "\n"; cerr << "XML error description: " << result.description() <<" "<< fileName_ <<"\n";
cerr << "XML error offset : " << result.offset << "\n"; cerr << "XML error offset : " << result.offset <<" "<< fileName_ <<"\n";
abort(); abort();
} }
if ( toplev == std::string("") ) { if ( toplev == std::string("") ) {