]> git.sesse.net Git - xml-template/blob - c++0x/simple.cpp
05c7ea64f6ad4a49338412173c8814c2d65ec290
[xml-template] / c++0x / simple.cpp
1 #include <stdio.h>
2 #include <string.h>
3 #include <libxml/parser.h>
4
5 #include "xml-template.h"
6
7 using namespace std;
8
9 int main(int argc, char **argv)
10 {
11         LIBXML_TEST_VERSION
12
13         unordered_map<string, Directive*> master_map;
14         master_map.insert(make_pair("title", new Replace("A very basic example")));
15         master_map.insert(make_pair("#hello", new Replace("Hello world!")));
16
17         xmlDocPtr doc = xmlParseFile(argv[1]);
18         Substitute(master_map).process(xmlDocGetRootElement(doc), false);
19         xmlSaveFile("out.xml", doc);
20
21         xmlCleanupParser();
22         xmlMemoryDump();
23         return(0);
24 }