fixed a comment applied a patch from Michael Day to add a new function
* xmlsave.c: fixed a comment
* xinclude.c include/libxml/xinclude.h: applied a patch from Michael Day
to add a new function providing the _private field for the generated
parser contexts xmlXIncludeProcessFlagsData()
Daniel
diff --git a/xinclude.c b/xinclude.c
index d5bba6e..c58bbcf 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -82,6 +82,8 @@
int legacy; /* using XINCLUDE_OLD_NS */
int parseFlags; /* the flags used for parsing XML documents */
xmlChar * base; /* the current xml:base */
+
+ void *_private; /* application data */
};
static int
@@ -427,6 +429,12 @@
xmlXIncludeErrMemory(ctxt, NULL, "cannot allocate parser context");
return(NULL);
}
+
+ /*
+ * pass in the application data to the parser context.
+ */
+ pctxt->_private = ctxt->_private;
+
/*
* try to ensure that new documents included are actually
* built with the same dictionary as the including document.
@@ -2409,9 +2417,11 @@
}
/**
- * xmlXIncludeProcessFlags:
+ * xmlXIncludeProcessFlagsData:
* @doc: an XML document
* @flags: a set of xmlParserOption used for parsing XML includes
+ * @data: application data that will be passed to the parser context
+ * in the _private field of the parser context(s)
*
* Implement the XInclude substitution on the XML document @doc
*
@@ -2419,7 +2429,7 @@
* or the number of substitutions done.
*/
int
-xmlXIncludeProcessFlags(xmlDocPtr doc, int flags) {
+xmlXIncludeProcessFlagsData(xmlDocPtr doc, int flags, void *data) {
xmlXIncludeCtxtPtr ctxt;
xmlNodePtr tree;
int ret = 0;
@@ -2432,6 +2442,7 @@
ctxt = xmlXIncludeNewContext(doc);
if (ctxt == NULL)
return(-1);
+ ctxt->_private = data;
ctxt->base = xmlStrdup((xmlChar *)doc->URL);
xmlXIncludeSetFlags(ctxt, flags);
ret = xmlXIncludeDoProcess(ctxt, doc, tree);
@@ -2443,6 +2454,21 @@
}
/**
+ * xmlXIncludeProcessFlags:
+ * @doc: an XML document
+ * @flags: a set of xmlParserOption used for parsing XML includes
+ *
+ * Implement the XInclude substitution on the XML document @doc
+ *
+ * Returns 0 if no substitution were done, -1 if some processing failed
+ * or the number of substitutions done.
+ */
+int
+xmlXIncludeProcessFlags(xmlDocPtr doc, int flags) {
+ return xmlXIncludeProcessFlagsData(doc, flags, NULL);
+}
+
+/**
* xmlXIncludeProcess:
* @doc: an XML document
*