X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=c%2B%2B0x%2Fsimple.cpp;h=0c895426383497494e362f9f8ddadd90d4827989;hb=ad45bc892752571fec46b21564e4683c074f1d46;hp=05c7ea64f6ad4a49338412173c8814c2d65ec290;hpb=59996859ced59ac9fdb307b2eb2130b48d4d4f63;p=xml-template diff --git a/c++0x/simple.cpp b/c++0x/simple.cpp index 05c7ea6..0c89542 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,12 @@ 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(argv[1]); - Substitute(master_map).process(xmlDocGetRootElement(doc), false); - xmlSaveFile("out.xml", doc); - - xmlCleanupParser(); - xmlMemoryDump(); + xmlDocPtr doc = process_file("../xml/simple.xml", &master_directive); + output_to_fd_and_free(doc, 1); return(0); }