mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-26 10:03:34 +03:00
Deprecate old HTML SAX API
This commit is contained in:
parent
51035c539e
commit
a308c0cdf7
@ -6402,6 +6402,8 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
|
||||
* @sax: the SAX handler block
|
||||
* @userData: if using SAX, this pointer will be provided on callbacks.
|
||||
*
|
||||
* DEPRECATED: Use htmlNewSAXParserCtxt and htmlCtxtReadDoc.
|
||||
*
|
||||
* Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks
|
||||
* to handle parse events. If sax is NULL, fallback to the default DOM
|
||||
* behavior and return a tree.
|
||||
@ -6523,6 +6525,8 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
|
||||
* @sax: the SAX handler block
|
||||
* @userData: if using SAX, this pointer will be provided on callbacks.
|
||||
*
|
||||
* DEPRECATED: Use htmlNewSAXParserCtxt and htmlCtxtReadFile.
|
||||
*
|
||||
* parse an HTML 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.
|
||||
|
@ -120,6 +120,7 @@ XMLPUBFUN htmlParserCtxtPtr XMLCALL
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlParseDocument(htmlParserCtxtPtr ctxt);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlSAXParseDoc (const xmlChar *cur,
|
||||
const char *encoding,
|
||||
@ -131,6 +132,7 @@ XMLPUBFUN htmlDocPtr XMLCALL
|
||||
XMLPUBFUN htmlParserCtxtPtr XMLCALL
|
||||
htmlCreateFileParserCtxt(const char *filename,
|
||||
const char *encoding);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlSAXParseFile(const char *filename,
|
||||
const char *encoding,
|
||||
|
@ -1557,6 +1557,7 @@ libxml_htmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
||||
const char *encoding;
|
||||
PyObject *pyobj_SAX = NULL;
|
||||
xmlSAXHandlerPtr SAX = NULL;
|
||||
htmlParserCtxtPtr ctxt;
|
||||
|
||||
if (!PyArg_ParseTuple
|
||||
(args, (char *) "Osz:htmlSAXParseFile", &pyobj_SAX, &URI,
|
||||
@ -1574,7 +1575,9 @@ libxml_htmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
||||
SAX = &pythonSaxHandler;
|
||||
Py_INCREF(pyobj_SAX);
|
||||
/* The reference is released in pythonEndDocument() */
|
||||
htmlSAXParseFile(URI, encoding, SAX, pyobj_SAX);
|
||||
ctxt = htmlNewSAXParserCtxt(SAX, pyobj_SAX);
|
||||
htmlCtxtReadFile(ctxt, URI, encoding, 0);
|
||||
htmlFreeParserCtxt(ctxt);
|
||||
Py_INCREF(Py_None);
|
||||
return (Py_None);
|
||||
#else
|
||||
|
12
runtest.c
12
runtest.c
@ -1726,7 +1726,11 @@ saxParseTest(const char *filename, const char *result,
|
||||
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
if (options & XML_PARSE_HTML) {
|
||||
htmlSAXParseFile(filename, NULL, emptySAXHandler, NULL);
|
||||
htmlParserCtxtPtr ctxt;
|
||||
|
||||
ctxt = htmlNewSAXParserCtxt(emptySAXHandler, NULL);
|
||||
htmlCtxtReadFile(ctxt, filename, NULL, options);
|
||||
htmlFreeParserCtxt(ctxt);
|
||||
ret = 0;
|
||||
} else
|
||||
#endif
|
||||
@ -1750,7 +1754,11 @@ saxParseTest(const char *filename, const char *result,
|
||||
}
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
if (options & XML_PARSE_HTML) {
|
||||
htmlSAXParseFile(filename, NULL, debugHTMLSAXHandler, NULL);
|
||||
htmlParserCtxtPtr ctxt;
|
||||
|
||||
ctxt = htmlNewSAXParserCtxt(debugHTMLSAXHandler, NULL);
|
||||
htmlCtxtReadFile(ctxt, filename, NULL, options);
|
||||
htmlFreeParserCtxt(ctxt);
|
||||
ret = 0;
|
||||
} else
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user