diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2014-03-06 00:11:17 +0000 |
---|---|---|
committer | andreas <andreas@daaaf23c-2e50-4459-9457-1e69db5a47bf> | 2014-03-06 00:11:17 +0000 |
commit | d99095f4a181357bf0c6d10846351eb0b58b1ccf (patch) | |
tree | 74daacc842023b14e27aa49403ee8d4aaa8bb172 /src/main.cpp | |
parent | f098dc45183d2b7a99e65b62448f59d12cc3c056 (diff) |
started to implement rudimentary XML reader (implemented expectOneOf function), changed some conventions in the used files (namespaces, include guards), moved anchor class from domain to document package, removed everything that does not work now from the CMakeLists.txt
git-svn-id: file:///var/local/svn/basicwriter@24 daaaf23c-2e50-4459-9457-1e69db5a47bf
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/main.cpp b/src/main.cpp index 5c01bc3..6e3457c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,36 +6,31 @@ #include <vector> #include <iostream> -#include <model/GraphNode.hpp> +#include <xml/XmlReader.hpp> -using namespace ousia; +using namespace ousia::xml; int main(int argc, char *argv[]) { - std::shared_ptr<GraphNode> nd1{new GraphNode("node1")}; - std::shared_ptr<GraphNode> nd2{new GraphNode("node2", nd1)}; - - std::cout << nd2->getParent()->getName() << std::endl; - - return 0; - // Open the file given as first argument -/* QFile file(argv[1]); + if (argc < 2) { + std::cout << "No filename specified!" << std::endl; + return 1; + } + + QFile file(argv[1]); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { std::cout << "Error while opening file " << argv[1] << std::endl; return 1; } - // Read all tags using the xml stream reader + // Create the QXmlStreamReader instance QXmlStreamReader xml(&file); - while (!xml.atEnd()) { - xml.readNext(); - } - if (xml.hasError()) { - std::cout << "Error while parsing XML: " << xml.errorString().toStdString() << " at line " << xml.lineNumber() << std::endl; - return 1; - } - return 0;*/ + // Pass it to the XmlReader + XmlReader xmlReader(xml); + xmlReader.process(); + + return 0; } |