better error handling when loading docs

This commit is contained in:
Jez Higgins 2010-12-19 22:44:06 +00:00
parent 4ab8d34349
commit 53184edc79

View file

@ -53,11 +53,13 @@ protected:
Arabica::SAX::InputSource<string_type, string_adaptor> is(SA::construct_from_utf8(filename.c_str())); Arabica::SAX::InputSource<string_type, string_adaptor> is(SA::construct_from_utf8(filename.c_str()));
Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser; Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
Arabica::SAX::CatchErrorHandler<std::string> eh;
parser.setErrorHandler(eh);
parser.parse(is); parser.parse(is);
Document d = parser.getDocument(); Document d = parser.getDocument();
if(d == 0) if(d == 0)
assertImplementation(false, "Could not load", -1, filename); assertImplementation(false, "Could not load : " + eh.errors(), -1, filename);
//d.normalize(); //d.normalize();
return d; return d;