From: mfranz Date: Fri, 29 Jun 2007 10:46:52 +0000 (+0000) Subject: easyxml.cxx: add missing endXML visitor call X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0bcdf2e4dc0ffd2fb335faad8e7e718ff5bfada5;p=simgear.git easyxml.cxx: add missing endXML visitor call testEasyXML.cxx: beef it up --- diff --git a/simgear/xml/easyxml.cxx b/simgear/xml/easyxml.cxx index cb6ee263..0aa71b18 100644 --- a/simgear/xml/easyxml.cxx +++ b/simgear/xml/easyxml.cxx @@ -258,6 +258,7 @@ readXML (istream &input, XMLVisitor &visitor, const string &path) } XML_ParserFree(parser); + visitor.endXML(); } void @@ -303,6 +304,7 @@ readXML (const char *buf, const int size, XMLVisitor &visitor) } XML_ParserFree(parser); + visitor.endXML(); } // end of easyxml.cxx diff --git a/simgear/xml/testEasyXML.cxx b/simgear/xml/testEasyXML.cxx index 4d6954f4..0c1f99c1 100644 --- a/simgear/xml/testEasyXML.cxx +++ b/simgear/xml/testEasyXML.cxx @@ -42,15 +42,24 @@ public: } }; -main (int ac, const char ** av) +int main (int ac, const char ** av) { MyVisitor visitor; for (int i = 1; i < ac; i++) { ifstream input(av[i]); cout << "Reading " << av[i] << endl; - if (!readXML(input, visitor)) { + try { + readXML(input, visitor); + + } catch (const sg_exception& e) { + cerr << "Error: file '" << av[i] << "' " << e.getFormattedMessage() << endl; + return -1; + + } catch (...) { cerr << "Error reading from " << av[i] << endl; + return -1; } } + return 0; }