]> git.sesse.net Git - xml-template/blobdiff - c++0x/include.cpp
Add include support, and unit test, to C++0x version. All unit tests pass!
[xml-template] / c++0x / include.cpp
diff --git a/c++0x/include.cpp b/c++0x/include.cpp
new file mode 100644 (file)
index 0000000..546be7b
--- /dev/null
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+#include "xml-template.h"
+
+using namespace std;
+
+int main(int argc, char **argv)
+{
+       Substitute doc_directive = {
+               make_pair("color", new Replace("red")),
+       };
+       xmlDocPtr doc = process_file("../xml/included.xml", &doc_directive, false);
+
+       Substitute master_directive = {
+               make_pair("title", new Replace("Main HTML title")),
+               make_pair("h1", new Replace("Nice heading here")),
+               make_pair("contents", new ReplaceInclude(doc)),
+       };
+
+       xmlDocPtr master = process_file("../xml/master.xml", &master_directive);
+       output_to_fd_and_free(master, 1);
+       return(0);
+}