]> git.sesse.net Git - xml-template/blobdiff - c++0x/simple.cpp
Move the C++0x file processing logic into a shared function.
[xml-template] / c++0x / simple.cpp
index cfc504181d25584d906fb61b922918ca15152bc1..36766f80c1ffa4acb01e647a7dd723691e6a0a0f 100644 (file)
@@ -1,6 +1,4 @@
 #include <stdio.h>
-#include <string.h>
-#include <libxml/parser.h>
 
 #include "xml-template.h"
 
@@ -8,17 +6,10 @@ using namespace std;
 
 int main(int argc, char **argv)
 {
-       LIBXML_TEST_VERSION
-
        unordered_map<string, Directive*> master_map;
        master_map.insert(make_pair("title", new Replace("A very basic example")));
        master_map.insert(make_pair("#hello", new Replace("Hello world!")));
 
-       xmlDocPtr doc = xmlParseFile("../xml/simple.xml");
-       Substitute(master_map).process(xmlDocGetRootElement(doc), false);
-       xmlSaveFile(argv[1], doc);
-
-       xmlCleanupParser();
-       xmlMemoryDump();
+       process_file("../xml/simple.xml", argv[1], new Substitute(master_map));
        return(0);
 }