Ok, so, I'm new to Xerces as of 48 hours ago, and so far I really like it; but this problem I just ran into is extraordinarily frustrating.
First, let me show you a test case of how it's _supposed_ to work: http://www.rutski89.com/static/xerces-test.cpp Running this code produces something like this: rut...@imac:~$ g++ test.cpp -lxerces-c && ./a.out fatal:SAXParseException:invalid document structure SAXException rut...@imac:~$ Just as expected, since the XML data is the empty string "", the fatalErorr() in MyErrorHandler is triggered, it re-throws its "e", and that is then caught by the "catch(const SAXException& e)" in main(). Of course, SAXParseException is a sub-type of SAXException, so you would expect the catch in main() to happen. But now take a look at this code which is totally the same, yet for some reason totally broken. Note that this is no longer self-contained test case code, there's no main(), you can run this, it's actually from my project: http://www.rutski89.com/static/xerces-broken.cpp When I call ParseXML("") for some reason it does NOT function the same as the test case. I have verified with test prints and gdb that fatalError() in ThrowErrorHandler is indeed triggered like it's supposed to be, so we're good so far. But then, for some weird reason, the "catch(const SAXException& e)" is NOT triggered. Instead, the SAXParseException which is re-thrown by fatalError() gets caught by "catch(...)" in ParseXML(). God knows why. I need it to catch properly! ARRRRRRRG! What did I do to deserves this!? A ver frustrated developer, -Patrick
