Year 2007.
[metaproxy-moved-to-github.git] / src / metaproxy_prog.cpp
index d5e5d1f..e231ee5 100644 (file)
@@ -1,7 +1,7 @@
-/* $Id: metaproxy_prog.cpp,v 1.4 2006-04-29 08:51:00 adam Exp $
-   Copyright (c) 2005-2006, Index Data.
+/* $Id: metaproxy_prog.cpp,v 1.9 2007-01-25 14:05:54 adam Exp $
+   Copyright (c) 2005-2007, Index Data.
 
-%LICENSE%
+   See the LICENSE file for details
  */
 
 #include "config.hpp"
@@ -11,6 +11,7 @@ namespace po = boost::program_options;
 
 #include <iostream>
 #include <stdexcept>
+#include <libxml/xinclude.h>
 
 #include "filter.hpp"
 #include "package.hpp"
@@ -58,12 +59,23 @@ int main(int argc, char **argv)
                 std::exit(1);
             }
             
-            doc = xmlParseFile(config_fnames[0].c_str());
+            // need to parse with xinclude tags 
+            // XML_PARSE_XINCLUDE XML_PARSE_NOBLANKS  
+            // XML_PARSE_NSCLEAN XML_PARSE_NONET 
+            doc = xmlReadFile(config_fnames[0].c_str(), 
+                              NULL, 
+                              XML_PARSE_XINCLUDE + XML_PARSE_NOBLANKS
+                              + XML_PARSE_NSCLEAN + XML_PARSE_NONET );
+
             if (!doc)
             {
-                std::cerr << "xmlParseFile failed\n";
+                std::cerr << "XML parsing failed\n";
                 std::exit(1);
             }
+            // and perform Xinclude then
+            if (xmlXIncludeProcess(doc) > 0) {
+                std::cerr << "processing XInclude directive\n";
+            }
         }
         else
         {
@@ -79,7 +91,7 @@ int main(int argc, char **argv)
                 pack.router(router).move();
             }
             catch (std::runtime_error &e) {
-                std::cout << "std::runtime error: " << e.what() << "\n";
+                std::cerr << "std::runtime error: " << e.what() << "\n";
                 std::exit(1);
             }
             xmlFreeDoc(doc);
@@ -94,7 +106,7 @@ int main(int argc, char **argv)
         std::exit(1);
     }
     catch (std::runtime_error &e) {
-        std::cout << "std::runtime error: " << e.what() << "\n";
+        std::cerr << "std::runtime error: " << e.what() << "\n";
         std::exit(1);
     }
     catch ( ... ) {