Define our desires for POSIX and X/OPEN API features properly.
[asterisk/asterisk.git] / main / xml.c
index 9a0c66d..36e7dd8 100644 (file)
@@ -29,6 +29,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #if defined(HAVE_LIBXML2)
 #include <libxml/parser.h>
 #include <libxml/tree.h>
+#include <libxml/xinclude.h>
 /* libxml2 ast_xml implementation. */
 
 
@@ -55,11 +56,17 @@ struct ast_xml_doc *ast_xml_open(char *filename)
        }
 
        doc = xmlReadFile(filename, NULL, XML_PARSE_RECOVER);
+       if (doc) {
+               /* process xinclude elements. */
+               if (xmlXIncludeProcess(doc) < 0) {
+                       xmlFreeDoc(doc);
+                       return NULL;
+               }
+       }
 
        return (struct ast_xml_doc *) doc;
 }
 
-
 void ast_xml_close(struct ast_xml_doc *doc)
 {
        if (!doc) {