From 0bcdf2e4dc0ffd2fb335faad8e7e718ff5bfada5 Mon Sep 17 00:00:00 2001 From: mfranz Date: Fri, 29 Jun 2007 10:46:52 +0000 Subject: [PATCH] easyxml.cxx: add missing endXML visitor call testEasyXML.cxx: beef it up --- simgear/xml/easyxml.cxx | 2 ++ simgear/xml/testEasyXML.cxx | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) 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; } -- 2.39.5