src/relpipe-out-xml.cpp
branchv_0
changeset 13 816094aa1fff
parent 5 7c84323969d1
child 23 47a7d86ad810
equal deleted inserted replaced
12:b8274181b061 13:816094aa1fff
    22 #include <relpipe/cli/CLI.h>
    22 #include <relpipe/cli/CLI.h>
    23 #include <relpipe/cli/RelpipeCLIException.h>
    23 #include <relpipe/cli/RelpipeCLIException.h>
    24 #include <relpipe/reader/Factory.h>
    24 #include <relpipe/reader/Factory.h>
    25 #include <relpipe/reader/RelationalReader.h>
    25 #include <relpipe/reader/RelationalReader.h>
    26 #include <relpipe/reader/RelpipeReaderException.h>
    26 #include <relpipe/reader/RelpipeReaderException.h>
       
    27 #include <relpipe/xmlwriter/RelpipeXMLWriterException.h>
    27 
    28 
    28 #include "XmlHandler.h"
    29 #include "XmlHandler.h"
    29 
    30 
    30 using namespace relpipe::cli;
    31 using namespace relpipe::cli;
    31 using namespace relpipe::reader;
    32 using namespace relpipe::reader;
    32 using namespace relpipe::out::xml;
    33 using namespace relpipe::out::xml;
       
    34 using namespace relpipe::xmlwriter;
    33 
    35 
    34 int main(int argc, char** argv) {
    36 int main(int argc, char** argv) {
    35 	setlocale(LC_ALL, "");
    37 	setlocale(LC_ALL, "");
    36 	CLI::untieStdIO();
    38 	CLI::untieStdIO();
    37 	CLI cli(argc, argv);
    39 	CLI cli(argc, argv);
    55 		resultCode = e.getExitCode();
    57 		resultCode = e.getExitCode();
    56 	} catch (RelpipeReaderException e) {
    58 	} catch (RelpipeReaderException e) {
    57 		fwprintf(stderr, L"Caught Reader exception: %ls\n", e.getMessge().c_str());
    59 		fwprintf(stderr, L"Caught Reader exception: %ls\n", e.getMessge().c_str());
    58 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    60 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    59 		resultCode = CLI::EXIT_CODE_DATA_ERROR;
    61 		resultCode = CLI::EXIT_CODE_DATA_ERROR;
       
    62 	} catch (RelpipeXMLWriterException e) {
       
    63 		fwprintf(stderr, L"Error while writing XML: %ls\n", e.getMessge().c_str());
       
    64 		resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
    60 	}
    65 	}
    61 
    66 
    62 	return resultCode;
    67 	return resultCode;
    63 }
    68 }