summaryrefslogtreecommitdiff
path: root/algo1w4d1/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'algo1w4d1/main.cpp')
-rw-r--r--algo1w4d1/main.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/algo1w4d1/main.cpp b/algo1w4d1/main.cpp
new file mode 100644
index 0000000..d641db0
--- /dev/null
+++ b/algo1w4d1/main.cpp
@@ -0,0 +1,17 @@
+#include <iostream>
+#include <string>
+
+#include "ValidXML.h"
+
+int main(int argc, char** argv) {
+ // input is always read from stdin until EOF (ctrl-d when tty is connected to terminal)
+ std::string input((std::istreambuf_iterator<char>(std::cin)), std::istreambuf_iterator<char>());
+
+ ValidXML parser;
+ for (char c : input)
+ parser.parse(c);
+
+ std::cout << "XML is " << (parser.input_valid() ? "valid" : "invalid") << std::endl;
+
+ return 0;
+}