]> git.sesse.net Git - xml-template/blobdiff - c++0x/simple.cpp
Fix a potential bug in the C++0x cleaning.
[xml-template] / c++0x / simple.cpp
index 05c7ea64f6ad4a49338412173c8814c2d65ec290..5ac223d09f72eda03769dd1d1bef78b964cf8de3 100644 (file)
@@ -1,6 +1,4 @@
 #include <stdio.h>
-#include <string.h>
-#include <libxml/parser.h>
 
 #include "xml-template.h"
 
@@ -8,17 +6,11 @@ using namespace std;
 
 int main(int argc, char **argv)
 {
-       LIBXML_TEST_VERSION
+       Substitute master_directive = {
+               make_pair("title", new Replace("A very basic example")),
+               make_pair("#hello", new Replace("Hello world!")),
+       };
 
-       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(argv[1]);
-       Substitute(master_map).process(xmlDocGetRootElement(doc), false);
-       xmlSaveFile("out.xml", doc);
-
-       xmlCleanupParser();
-       xmlMemoryDump();
+       process_file("../xml/simple.xml", argv[1], &master_directive);
        return(0);
 }