1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-23 01:52:48 +03:00

tree: Deprecate public struct members related to DTDs

Let's deprecate these members for now. If these are really used, they
can be undeprecated later.
This commit is contained in:
Nick Wellnhofer
2025-05-19 21:17:39 +02:00
parent 3ab040c203
commit fca0860d6c
2 changed files with 80 additions and 50 deletions

View File

@@ -193,14 +193,17 @@ typedef struct _xmlNotation xmlNotation;
typedef xmlNotation *xmlNotationPtr; typedef xmlNotation *xmlNotationPtr;
/** /**
* A DTD Notation definition. * A DTD Notation definition.
*
* Should be treated as opaque. Accessing members directly
* is deprecated.
*/ */
struct _xmlNotation { struct _xmlNotation {
/** Notation name */ /** Notation name */
const xmlChar *name; const xmlChar *name XML_DEPRECATED_MEMBER;
/** Public identifier, if any */ /** Public identifier, if any */
const xmlChar *PublicID; const xmlChar *PublicID XML_DEPRECATED_MEMBER;
/** System identifier, if any */ /** System identifier, if any */
const xmlChar *SystemID; const xmlChar *SystemID XML_DEPRECATED_MEMBER;
}; };
/** /**
@@ -233,16 +236,24 @@ typedef struct _xmlEnumeration xmlEnumeration;
typedef xmlEnumeration *xmlEnumerationPtr; typedef xmlEnumeration *xmlEnumerationPtr;
/** /**
* List structure used when there is an enumeration in DTDs. * List structure used when there is an enumeration in DTDs.
*
* Should be treated as opaque. Accessing members directly
* is deprecated.
*/ */
struct _xmlEnumeration { struct _xmlEnumeration {
struct _xmlEnumeration *next; /* next one */ /** next enumeration */
const xmlChar *name; /* Enumeration name */ struct _xmlEnumeration *next XML_DEPRECATED_MEMBER;
/** value */
const xmlChar *name XML_DEPRECATED_MEMBER;
}; };
typedef struct _xmlAttribute xmlAttribute; typedef struct _xmlAttribute xmlAttribute;
typedef xmlAttribute *xmlAttributePtr; typedef xmlAttribute *xmlAttributePtr;
/** /**
* An Attribute declaration in a DTD. * An Attribute declaration in a DTD.
*
* Should be treated as opaque. Accessing members directly
* is deprecated.
*/ */
struct _xmlAttribute { struct _xmlAttribute {
/** application data */ /** application data */
@@ -265,19 +276,19 @@ struct _xmlAttribute {
struct _xmlDoc *doc; struct _xmlDoc *doc;
/** next in hash table */ /** next in hash table */
struct _xmlAttribute *nexth; struct _xmlAttribute *nexth XML_DEPRECATED_MEMBER;
/** attribute type */ /** attribute type */
xmlAttributeType atype; xmlAttributeType atype XML_DEPRECATED_MEMBER;
/** attribute default */ /** attribute default */
xmlAttributeDefault def; xmlAttributeDefault def XML_DEPRECATED_MEMBER;
/** default value */ /** default value */
const xmlChar *defaultValue; const xmlChar *defaultValue XML_DEPRECATED_MEMBER;
/** enumeration tree if any */ /** enumeration tree if any */
xmlEnumeration *tree; xmlEnumeration *tree XML_DEPRECATED_MEMBER;
/** namespace prefix if any */ /** namespace prefix if any */
const xmlChar *prefix; const xmlChar *prefix XML_DEPRECATED_MEMBER;
/** element name */ /** element name */
const xmlChar *elem; const xmlChar *elem XML_DEPRECATED_MEMBER;
}; };
/** /**
@@ -305,22 +316,25 @@ typedef xmlElementContent *xmlElementContentPtr;
/** /**
* An XML Element content as stored after parsing an element definition * An XML Element content as stored after parsing an element definition
* in a DTD. * in a DTD.
*
* Should be treated as opaque. Accessing members directly
* is deprecated.
*/ */
struct _xmlElementContent { struct _xmlElementContent {
/** PCDATA, ELEMENT, SEQ or OR */ /** PCDATA, ELEMENT, SEQ or OR */
xmlElementContentType type; xmlElementContentType type XML_DEPRECATED_MEMBER;
/** ONCE, OPT, MULT or PLUS */ /** ONCE, OPT, MULT or PLUS */
xmlElementContentOccur ocur; xmlElementContentOccur ocur XML_DEPRECATED_MEMBER;
/** element name */ /** element name */
const xmlChar *name; const xmlChar *name XML_DEPRECATED_MEMBER;
/** first child */ /** first child */
struct _xmlElementContent *c1; struct _xmlElementContent *c1 XML_DEPRECATED_MEMBER;
/** second child */ /** second child */
struct _xmlElementContent *c2; struct _xmlElementContent *c2 XML_DEPRECATED_MEMBER;
/** parent */ /** parent */
struct _xmlElementContent *parent; struct _xmlElementContent *parent XML_DEPRECATED_MEMBER;
/** namespace prefix */ /** namespace prefix */
const xmlChar *prefix; const xmlChar *prefix XML_DEPRECATED_MEMBER;
}; };
/** /**
@@ -338,6 +352,9 @@ typedef struct _xmlElement xmlElement;
typedef xmlElement *xmlElementPtr; typedef xmlElement *xmlElementPtr;
/** /**
* An XML Element declaration from a DTD. * An XML Element declaration from a DTD.
*
* Should be treated as opaque. Accessing members directly
* is deprecated.
*/ */
struct _xmlElement { struct _xmlElement {
/** application data */ /** application data */
@@ -360,18 +377,18 @@ struct _xmlElement {
struct _xmlDoc *doc; struct _xmlDoc *doc;
/** element type */ /** element type */
xmlElementTypeVal etype; xmlElementTypeVal etype XML_DEPRECATED_MEMBER;
/** allowed element content */ /** allowed element content */
xmlElementContent *content; xmlElementContent *content XML_DEPRECATED_MEMBER;
/** list of declared attributes */ /** list of declared attributes */
xmlAttribute *attributes; xmlAttribute *attributes XML_DEPRECATED_MEMBER;
/** namespace prefix if any */ /** namespace prefix if any */
const xmlChar *prefix; const xmlChar *prefix XML_DEPRECATED_MEMBER;
#ifdef LIBXML_REGEXP_ENABLED #ifdef LIBXML_REGEXP_ENABLED
/** validating regexp */ /** validating regexp */
xmlRegexp *contModel; xmlRegexp *contModel XML_DEPRECATED_MEMBER;
#else #else
void *contModel; void *contModel XML_DEPRECATED_MEMBER;
#endif #endif
}; };
@@ -407,7 +424,7 @@ struct _xmlNs {
/** application data */ /** application data */
void *_private; void *_private;
/** normally an xmlDoc */ /** normally an xmlDoc */
struct _xmlDoc *context; struct _xmlDoc *context XML_DEPRECATED_MEMBER;
}; };
typedef struct _xmlDtd xmlDtd; typedef struct _xmlDtd xmlDtd;
@@ -415,6 +432,9 @@ typedef xmlDtd *xmlDtdPtr;
/** /**
* An XML DTD, as defined by <!DOCTYPE ... There is actually one for * An XML DTD, as defined by <!DOCTYPE ... There is actually one for
* the internal subset and for the external subset. * the internal subset and for the external subset.
*
* Should be treated as opaque. Accessing members directly
* is deprecated.
*/ */
struct _xmlDtd { struct _xmlDtd {
/** application data */ /** application data */
@@ -439,19 +459,19 @@ struct _xmlDtd {
/* End of common part */ /* End of common part */
/** hash table for notations if any */ /** hash table for notations if any */
void *notations; void *notations XML_DEPRECATED_MEMBER;
/** hash table for elements if any */ /** hash table for elements if any */
void *elements; void *elements XML_DEPRECATED_MEMBER;
/** hash table for attributes if any */ /** hash table for attributes if any */
void *attributes; void *attributes XML_DEPRECATED_MEMBER;
/** hash table for entities if any */ /** hash table for entities if any */
void *entities; void *entities XML_DEPRECATED_MEMBER;
/** public identifier */ /** public identifier */
const xmlChar *ExternalID; const xmlChar *ExternalID XML_DEPRECATED_MEMBER;
/** system identifier */ /** system identifier */
const xmlChar *SystemID; const xmlChar *SystemID XML_DEPRECATED_MEMBER;
/** hash table for parameter entities if any */ /** hash table for parameter entities if any */
void *pentities; void *pentities XML_DEPRECATED_MEMBER;
}; };
typedef struct _xmlAttr xmlAttr; typedef struct _xmlAttr xmlAttr;
@@ -485,27 +505,30 @@ struct _xmlAttr {
/** for type/PSVI information */ /** for type/PSVI information */
void *psvi; void *psvi;
/** ID struct if any */ /** ID struct if any */
struct _xmlID *id; struct _xmlID *id XML_DEPRECATED_MEMBER;
}; };
typedef struct _xmlID xmlID; typedef struct _xmlID xmlID;
typedef xmlID *xmlIDPtr; typedef xmlID *xmlIDPtr;
/** /**
* An XML ID instance. * An XML ID instance.
*
* Should be treated as opaque. Accessing members directly
* is deprecated.
*/ */
struct _xmlID { struct _xmlID {
/* next ID */ /* next ID */
struct _xmlID *next; struct _xmlID *next XML_DEPRECATED_MEMBER;
/* The ID name */ /* The ID name */
const xmlChar *value; const xmlChar *value XML_DEPRECATED_MEMBER;
/* The attribute holding it */ /* The attribute holding it */
xmlAttr *attr; xmlAttr *attr XML_DEPRECATED_MEMBER;
/* The attribute if attr is not available */ /* The attribute if attr is not available */
const xmlChar *name; const xmlChar *name XML_DEPRECATED_MEMBER;
/* The line number if attr is not available */ /* The line number if attr is not available */
int lineno; int lineno XML_DEPRECATED_MEMBER;
/* The document holding the ID */ /* The document holding the ID */
struct _xmlDoc *doc; struct _xmlDoc *doc XML_DEPRECATED_MEMBER;
}; };
/** @cond ignore */ /** @cond ignore */
@@ -515,11 +538,16 @@ typedef xmlRef *xmlRefPtr;
* An XML IDREF instance. * An XML IDREF instance.
*/ */
struct _xmlRef { struct _xmlRef {
struct _xmlRef *next; /* next Ref */ /* next Ref */
const xmlChar *value; /* The Ref name */ struct _xmlRef *next XML_DEPRECATED_MEMBER;
xmlAttr *attr; /* The attribute holding it */ /* The Ref name */
const xmlChar *name; /* The attribute if attr is not available */ const xmlChar *value XML_DEPRECATED_MEMBER;
int lineno; /* The line number if attr is not available */ /* The attribute holding it */
xmlAttr *attr XML_DEPRECATED_MEMBER;
/* The attribute if attr is not available */
const xmlChar *name XML_DEPRECATED_MEMBER;
/* The line number if attr is not available */
int lineno XML_DEPRECATED_MEMBER;
}; };
/** @endcond */ /** @endcond */
@@ -628,7 +656,7 @@ struct _xmlDoc {
/* End of common part */ /* End of common part */
/** level of zlib compression */ /** level of zlib compression */
int compression; int compression XML_DEPRECATED_MEMBER;
/** /**
* standalone document (no external refs) * standalone document (no external refs)
* *
@@ -644,19 +672,19 @@ struct _xmlDoc {
/** external subset */ /** external subset */
struct _xmlDtd *extSubset; struct _xmlDtd *extSubset;
/** used to hold the XML namespace if needed */ /** used to hold the XML namespace if needed */
struct _xmlNs *oldNs; struct _xmlNs *oldNs XML_DEPRECATED_MEMBER;
/** version string from XML declaration */ /** version string from XML declaration */
const xmlChar *version; const xmlChar *version;
/** actual encoding if any */ /** actual encoding if any */
const xmlChar *encoding; const xmlChar *encoding;
/** hash table for ID attributes if any */ /** hash table for ID attributes if any */
void *ids; void *ids XML_DEPRECATED_MEMBER;
/** hash table for IDREFs attributes if any */ /** hash table for IDREFs attributes if any */
void *refs; void *refs XML_DEPRECATED_MEMBER;
/** URI of the document */ /** URI of the document */
const xmlChar *URL; const xmlChar *URL;
/** unused */ /** unused */
int charset; int charset XML_DEPRECATED_MEMBER;
/** dict used to allocate names if any */ /** dict used to allocate names if any */
struct _xmlDict *dict; struct _xmlDict *dict;
/** for type/PSVI information */ /** for type/PSVI information */

View File

@@ -1212,6 +1212,7 @@ pythonAttributeDecl(void *user_data,
PyObject *result; PyObject *result;
int count; int count;
XML_IGNORE_DEPRECATION_WARNINGS
handler = (PyObject *) user_data; handler = (PyObject *) user_data;
if (PyObject_HasAttrString(handler, "attributeDecl")) { if (PyObject_HasAttrString(handler, "attributeDecl")) {
count = 0; count = 0;
@@ -1234,6 +1235,7 @@ pythonAttributeDecl(void *user_data,
Py_XDECREF(nameList); Py_XDECREF(nameList);
Py_XDECREF(result); Py_XDECREF(result);
} }
XML_POP_WARNINGS
} }
static void static void