easyxml.cxx: add missing endXML visitor call
testEasyXML.cxx: beef it up
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user