[libxml2] Generate deprecation warnings for old SAX API
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Generate deprecation warnings for old SAX API
- Date: Fri, 26 Aug 2022 02:59:28 +0000 (UTC)
commit 51035c539edf67de93ced3cf037bb1f2b298e526
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Thu Aug 25 19:53:04 2022 +0200
Generate deprecation warnings for old SAX API
include/libxml/SAX2.h | 1 +
include/libxml/parser.h | 15 +++++++++++++++
python/generator.py | 6 ++++++
python/libxml.c | 5 ++++-
4 files changed, 26 insertions(+), 1 deletion(-)
---
diff --git a/include/libxml/SAX2.h b/include/libxml/SAX2.h
index 8e9b0b95..2d75f9b0 100644
--- a/include/libxml/SAX2.h
+++ b/include/libxml/SAX2.h
@@ -146,6 +146,7 @@ XMLPUBFUN void XMLCALL
int len);
#ifdef LIBXML_SAX1_ENABLED
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlSAXDefaultVersion (int version);
#endif /* LIBXML_SAX1_ENABLED */
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index fc8f2f47..f96148b5 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -861,11 +861,14 @@ XMLPUBFUN int XMLCALL
/*
* Recovery mode
*/
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlRecoverDoc (const xmlChar *cur);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlRecoverMemory (const char *buffer,
int size);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlRecoverFile (const char *filename);
#endif /* LIBXML_SAX1_ENABLED */
@@ -878,47 +881,57 @@ XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
void *user_data,
const char *filename);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
void *user_data,
const char *buffer,
int size);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseDoc (xmlSAXHandlerPtr sax,
const xmlChar *cur,
int recovery);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseMemory (xmlSAXHandlerPtr sax,
const char *buffer,
int size,
int recovery);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
const char *buffer,
int size,
int recovery,
void *data);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseFile (xmlSAXHandlerPtr sax,
const char *filename,
int recovery);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
const char *filename,
int recovery,
void *data);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseEntity (xmlSAXHandlerPtr sax,
const char *filename);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlParseEntity (const char *filename);
#endif /* LIBXML_SAX1_ENABLED */
#ifdef LIBXML_VALID_ENABLED
+XML_DEPRECATED
XMLPUBFUN xmlDtdPtr XMLCALL
xmlSAXParseDTD (xmlSAXHandlerPtr sax,
const xmlChar *ExternalID,
@@ -955,6 +968,7 @@ XMLPUBFUN int XMLCALL
const xmlChar *string,
xmlNodePtr *lst,
int recover);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlParseExternalEntity (xmlDocPtr doc,
xmlSAXHandlerPtr sax,
@@ -984,6 +998,7 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL
xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
const xmlChar* buffer,
diff --git a/python/generator.py b/python/generator.py
index 8a1a49c7..2ab97335 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -310,15 +310,21 @@ deprecated_funcs = {
'xmlNanoFTPProxy': True,
'xmlNanoFTPScanProxy': True,
'xmlNewGlobalNs': True,
+ 'xmlParseEntity': True,
'xmlParseNamespace': True,
'xmlParseQuotedString': True,
'xmlParserHandleReference': True,
+ 'xmlRecoverDoc': True,
+ 'xmlRecoverFile': True,
+ 'xmlRecoverMemory': True,
'xmlRelaxNGCleanupTypes': True,
'xmlRelaxNGInitTypes': True,
'xmlRemoveRef': True,
+ 'xmlSAXDefaultVersion': True,
'xmlScanName': True,
'xmlSchemaCleanupTypes': True,
'xmlSchemaInitTypes': True,
+ 'xmlSetupParserForBuffer': True,
'xmlThrDefDefaultBufferSize': True,
'xmlThrDefLineNumbersDefaultValue': True,
'xmlThrDefPedanticParserDefaultValue': True,
diff --git a/python/libxml.c b/python/libxml.c
index e071e824..ead223f1 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -1524,6 +1524,7 @@ libxml_xmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
const char *URI;
PyObject *pyobj_SAX = NULL;
xmlSAXHandlerPtr SAX = NULL;
+ xmlParserCtxtPtr ctxt;
if (!PyArg_ParseTuple(args, (char *) "Osi:xmlSAXParseFile", &pyobj_SAX,
&URI, &recover))
@@ -1540,7 +1541,9 @@ libxml_xmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
SAX = &pythonSaxHandler;
Py_INCREF(pyobj_SAX);
/* The reference is released in pythonEndDocument() */
- xmlSAXUserParseFile(SAX, pyobj_SAX, URI);
+ ctxt = xmlNewSAXParserCtxt(SAX, pyobj_SAX);
+ xmlCtxtReadFile(ctxt, URI, NULL, 0);
+ xmlFreeParserCtxt(ctxt);
#endif /* LIBXML_SAX1_ENABLED */
Py_INCREF(Py_None);
return (Py_None);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]