X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=c%2B%2B0x%2Fsimple.cpp;h=5ac223d09f72eda03769dd1d1bef78b964cf8de3;hb=83a41af3311ec494205205ec093ffff0aad56fd0;hp=cfc504181d25584d906fb61b922918ca15152bc1;hpb=463ec2a071522ca887d1548bc1a5f01ed0263b01;p=xml-template diff --git a/c++0x/simple.cpp b/c++0x/simple.cpp index cfc5041..5ac223d 100644 --- a/c++0x/simple.cpp +++ b/c++0x/simple.cpp @@ -1,6 +1,4 @@ #include -#include -#include #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 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], &master_directive); return(0); }