src/XMLCommand.h
branchv_0
changeset 2 3ab78bf63467
parent 1 9aed8c2ea97d
child 3 4b566dee1a57
--- a/src/XMLCommand.h	Thu Jan 10 20:05:13 2019 +0100
+++ b/src/XMLCommand.h	Fri Jan 11 00:29:32 2019 +0100
@@ -30,6 +30,8 @@
 
 #include <relpipe/writer/typedefs.h>
 
+#include "StreamInputSource.h"
+
 namespace relpipe {
 namespace in {
 namespace xml {
@@ -40,7 +42,23 @@
 	void process(std::istream& input, std::ostream& output) {
 		using namespace relpipe::writer;
 		using namespace xercesc;
-		std::shared_ptr<RelationalWriter> writer(Factory::create(output));
+		unique_ptr<RelationalWriter> writer(Factory::create(output));
+		XMLPlatformUtils::Initialize();
+
+
+		unique_ptr<SAX2XMLReader> parser(XMLReaderFactory::createXMLReader());
+		parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
+		parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
+
+		// TODO: custom handler that reads
+		DefaultHandler defaultHandler;
+		parser->setContentHandler(&defaultHandler);
+		parser->setErrorHandler(&defaultHandler);
+
+		StreamInputSource inputSource(input);
+
+		parser->parse(inputSource);
+
 
 		// TODO: remove demo
 		// Various data types passed as strings
@@ -53,7 +71,7 @@
 		writer->writeAttribute(L"a");
 		writer->writeAttribute(L"1");
 		writer->writeAttribute(L"true");
-		
+
 	}
 };