adding xmlSAXParseFileWithData following Marco Stipek suggestion Daniel
* win32/dsp/libxml2.def.src include/libxml/parser.h parser.c:
adding xmlSAXParseFileWithData following Marco Stipek suggestion
Daniel
diff --git a/ChangeLog b/ChangeLog
index fe9f69b..7b32133 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Oct 2 15:52:05 CEST 2001 Daniel Veillard <daniel@veillard.com>
+
+ * win32/dsp/libxml2.def.src include/libxml/parser.h parser.c:
+ adding xmlSAXParseFileWithData following Marco Stipek suggestion
+
Tue Oct 2 11:27:58 CEST 2001 Daniel Veillard <daniel@veillard.com>
* valid.c: close bug #61550 when xml: wasn't considered a namespace
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index 1cf7f52..9c4c272 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -456,6 +456,10 @@
xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
const char *filename,
int recovery);
+xmlDocPtr xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
+ const char *filename,
+ int recovery,
+ void *data);
xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
const char *filename);
xmlDocPtr xmlParseEntity (const char *filename);
diff --git a/parser.c b/parser.c
index 08635cd..c52529b 100644
--- a/parser.c
+++ b/parser.c
@@ -9726,23 +9726,27 @@
}
/**
- * xmlSAXParseFile:
+ * xmlSAXParseFileWithData:
* @sax: the SAX handler block
* @filename: the filename
* @recovery: work in recovery mode, i.e. tries to read no Well Formed
* documents
+ * @data: the userdata
*
* parse an XML file and build a tree. Automatic support for ZLIB/Compress
* compressed document is provided by default if found at compile-time.
* It use the given SAX function block to handle the parsing callback.
* If sax is NULL, fallback to the default DOM tree building routines.
*
+ * User data (void *) is stored within the parser context, so it is
+ * available nearly everywhere in libxml.
+ *
* Returns the resulting document tree
*/
xmlDocPtr
-xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename,
- int recovery) {
+xmlSAXParseFileWithData(xmlSAXHandlerPtr sax, const char *filename,
+ int recovery, void *data) {
xmlDocPtr ret;
xmlParserCtxtPtr ctxt;
char *directory = NULL;
@@ -9756,6 +9760,9 @@
xmlFree(ctxt->sax);
ctxt->sax = sax;
}
+ if (data!=NULL) {
+ ctxt->_private=data;
+ }
if ((ctxt->directory == NULL) && (directory == NULL))
directory = xmlParserGetDirectory(filename);
@@ -9778,6 +9785,27 @@
}
/**
+ * xmlSAXParseFile:
+ * @sax: the SAX handler block
+ * @filename: the filename
+ * @recovery: work in recovery mode, i.e. tries to read no Well Formed
+ * documents
+ *
+ * parse an XML file and build a tree. Automatic support for ZLIB/Compress
+ * compressed document is provided by default if found at compile-time.
+ * It use the given SAX function block to handle the parsing callback.
+ * If sax is NULL, fallback to the default DOM tree building routines.
+ *
+ * Returns the resulting document tree
+ */
+
+xmlDocPtr
+xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename,
+ int recovery) {
+ return(xmlSAXParseFileWithData(sax,filename,recovery,NULL));
+}
+
+/**
* xmlRecoverDoc:
* @cur: a pointer to an array of xmlChar
*
diff --git a/win32/dsp/libxml2.def.src b/win32/dsp/libxml2.def.src
index 80a08a4..ae969ec 100644
--- a/win32/dsp/libxml2.def.src
+++ b/win32/dsp/libxml2.def.src
@@ -290,6 +290,7 @@
xmlSAXUserParseMemory
xmlSAXParseMemory
xmlSAXParseFile
+ xmlSAXParseFileWithData
xmlSAXParseEntity
xmlParseEntity
xmlParseDTD