diff -r c043377a757f -r 82ba555a97d1 src/relpipe-out-xml.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/relpipe-out-xml.cpp Sun Sep 16 14:39:10 2018 +0200 @@ -0,0 +1,38 @@ +#include +#include + +#include +#include +#include +#include +#include + +#include "XmlHandler.h" + +using namespace relpipe::cli; +using namespace relpipe::reader; +using namespace relpipe::out::tabular; + +int main(int argc, char** argv) { + CLI cli(argc, argv); + + int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR; + + try { + std::shared_ptr reader(Factory::create(std::cin)); + XmlHandler handler(std::cout); + reader->addHandler(&handler); + reader->process(); + resultCode = CLI::EXIT_CODE_SUCCESS; + } catch (RelpipeCLIException e) { + fwprintf(stderr, L"Caught CLI exception: %ls\n", e.getMessge().c_str()); + fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount()); + resultCode = e.getExitCode(); + } catch (RelpipeReaderException e) { + fwprintf(stderr, L"Caught Reader exception: %ls\n", e.getMessge().c_str()); + fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount()); + resultCode = CLI::EXIT_CODE_DATA_ERROR; + } + + return resultCode; +}