mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-30 08:38:15 +01:00
Use CatchErrorHandler.h to report errors
This commit is contained in:
parent
df3d61ce71
commit
b7d79f2144
1 changed files with 10 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <SAX/InputSource.h>
|
||||
#include <iostream>
|
||||
#include <SAX/filter/Writer.h>
|
||||
#include <SAX/helpers/CatchErrorHandler.h>
|
||||
|
||||
////////////////////////////////////////////////
|
||||
int main(int argc, char* argv[])
|
||||
|
@ -21,7 +22,10 @@ int main(int argc, char* argv[])
|
|||
SAX::FeatureNames<std::string> fNames;
|
||||
SAX::XMLReader<std::string> parser;
|
||||
SAX::Writer writer(std::cout);
|
||||
SAX::CatchErrorHandler<std::string> eh;
|
||||
|
||||
writer.setParent(parser);
|
||||
writer.setErrorHandler(eh);
|
||||
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
|
@ -38,6 +42,12 @@ int main(int argc, char* argv[])
|
|||
|
||||
writer.parse(is);
|
||||
} // if(file != "-")
|
||||
|
||||
if(eh.errorsReported())
|
||||
{
|
||||
std::cerr << eh.errors() << std::endl;
|
||||
eh.reset();
|
||||
} // if ...
|
||||
} // for ...
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue