summaryrefslogtreecommitdiffstats
path: root/test/src/test-arabica-parsing.cpp
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-07-22 12:38:43 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-07-22 12:38:43 (GMT)
commitf2d8c967076e5d8ebd3ca718e14edef8acb5f87c (patch)
tree0bed80b7ff8081a6108e7c847a4489de272679c8 /test/src/test-arabica-parsing.cpp
parent7bd0256239f247ed01ee6c673e31283c794bb3d0 (diff)
downloaduscxml-f2d8c967076e5d8ebd3ca718e14edef8acb5f87c.zip
uscxml-f2d8c967076e5d8ebd3ca718e14edef8acb5f87c.tar.gz
uscxml-f2d8c967076e5d8ebd3ca718e14edef8acb5f87c.tar.bz2
Removed iOS project again
Diffstat (limited to 'test/src/test-arabica-parsing.cpp')
-rw-r--r--test/src/test-arabica-parsing.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/src/test-arabica-parsing.cpp b/test/src/test-arabica-parsing.cpp
new file mode 100644
index 0000000..2a09dd6
--- /dev/null
+++ b/test/src/test-arabica-parsing.cpp
@@ -0,0 +1,48 @@
+#include "uscxml/config.h"
+#include "uscxml/Common.h"
+#include <DOM/Document.hpp>
+#include <XPath/XPath.hpp>
+#include <DOM/SAX2DOM/SAX2DOM.hpp>
+#include <DOM/io/Stream.hpp>
+#include <SAX/helpers/CatchErrorHandler.hpp>
+#include <DOM/Events/EventTarget.hpp>
+#include <DOM/Events/EventListener.hpp>
+
+using namespace Arabica::DOM;
+
+int main(int argc, char** argv) {
+
+ {
+ std::stringstream* ss = new std::stringstream();
+ (*ss) << "<root>\n<![CDATA[\n< \" ' < > &\n]]>\n</root>";
+ // we need an auto_ptr for arabica to assume ownership
+ std::auto_ptr<std::istream> ssPtr(ss);
+ Arabica::SAX::InputSource<std::string> inputSource(ssPtr);
+
+ Arabica::SAX2DOM::Parser<std::string> domParser;
+ Arabica::SAX::CatchErrorHandler<std::string> errorHandler;
+ domParser.setErrorHandler(errorHandler);
+
+ if(!domParser.parse(inputSource)) {
+ std::cout << errorHandler.errors();
+ return -1;
+ }
+ std::cout << domParser.getDocument().getDocumentElement().getFirstChild().getNodeValue() << std::endl;
+ std::cout << domParser.getDocument() << std::endl;
+ }
+ {
+ Arabica::SAX::InputSource<std::string> inputSource;
+ inputSource.setSystemId("/Users/sradomski/Documents/TK/Code/uscxml/test/samples/uscxml/arabica/test-arabica-parsing.xml");
+
+ Arabica::SAX2DOM::Parser<std::string> domParser;
+ Arabica::SAX::CatchErrorHandler<std::string> errorHandler;
+ domParser.setErrorHandler(errorHandler);
+
+ if(!domParser.parse(inputSource)) {
+ std::cout << errorHandler.errors();
+ return -1;
+ }
+ std::cout << domParser.getDocument() << std::endl;
+ }
+
+} \ No newline at end of file