diff --git a/ChangeLog b/ChangeLog index fe9f69b8..7b321331 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Oct 2 15:52:05 CEST 2001 Daniel Veillard + + * 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 * 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 1cf7f527..9c4c272f 100644 --- a/include/libxml/parser.h +++ b/include/libxml/parser.h @@ -456,6 +456,10 @@ xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax, 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 08635cd0..c52529bf 100644 --- a/parser.c +++ b/parser.c @@ -9726,23 +9726,27 @@ xmlCreateFileParserCtxt(const char *filename) } /** - * 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 @@ xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename, xmlFree(ctxt->sax); ctxt->sax = sax; } + if (data!=NULL) { + ctxt->_private=data; + } if ((ctxt->directory == NULL) && (directory == NULL)) directory = xmlParserGetDirectory(filename); @@ -9777,6 +9784,27 @@ xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename, return(ret); } +/** + * 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 80a08a45..ae969ec3 100644 --- a/win32/dsp/libxml2.def.src +++ b/win32/dsp/libxml2.def.src @@ -290,6 +290,7 @@ EXPORTS xmlSAXUserParseMemory xmlSAXParseMemory xmlSAXParseFile + xmlSAXParseFileWithData xmlSAXParseEntity xmlParseEntity xmlParseDTD