src/relpipe-in-xml.cpp
branchv_0
changeset 6 be83e0f457a8
parent 4 1363ec0879ca
child 8 14e14a5db027
equal deleted inserted replaced
5:e5cf88ce91ac 6:be83e0f457a8
    28 #include <relpipe/writer/TypeId.h>
    28 #include <relpipe/writer/TypeId.h>
    29 
    29 
    30 #include <relpipe/cli/CLI.h>
    30 #include <relpipe/cli/CLI.h>
    31 
    31 
    32 #include "XMLCommand.h"
    32 #include "XMLCommand.h"
       
    33 #include "XercesStringConvertor.h"
    33 
    34 
    34 using namespace relpipe::cli;
    35 using namespace relpipe::cli;
    35 using namespace relpipe::writer;
    36 using namespace relpipe::writer;
    36 using namespace relpipe::in::xml;
    37 using namespace relpipe::in::xml;
    37 
    38 
    49 	} catch (RelpipeWriterException& e) {
    50 	} catch (RelpipeWriterException& e) {
    50 		fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str());
    51 		fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str());
    51 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    52 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    52 		resultCode = CLI::EXIT_CODE_DATA_ERROR;
    53 		resultCode = CLI::EXIT_CODE_DATA_ERROR;
    53 	} catch (const xercesc::XMLException& e) {
    54 	} catch (const xercesc::XMLException& e) {
    54 		// TODO: print message
    55 		XercesStringConvertor xConvertor;
    55 		// char* message = xercesc::XMLString::transcode(e.getMessage());
    56 		fwprintf(stderr, L"Caught xercesc::XMLException: %ls\n", xConvertor.toString(e.getMessage()).c_str());
    56 		fwprintf(stderr, L"Caught xercesc::XMLException\n");
       
    57 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    57 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    58 		resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
    58 		resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
    59 	} catch (const xercesc::SAXParseException& e) {
    59 	} catch (const xercesc::SAXParseException& e) {
    60 		// TODO: print message
    60 		XercesStringConvertor xConvertor;
    61 		// char* message = xercesc::XMLString::transcode(e.getMessage());
    61 		fwprintf(stderr, L"Caught xercesc::SAXParseException: %ls\n", xConvertor.toString(e.getMessage()).c_str());
    62 		fwprintf(stderr, L"Caught xercesc::SAXParseException\n");
    62 		fwprintf(stderr, L"\tat line: %d, column: %d\n", e.getLineNumber(), e.getColumnNumber());
    63 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    63 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    64 		resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
    64 		resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
    65 	}
    65 	}
    66 
    66 
    67 	return resultCode;
    67 	return resultCode;