Index: tree.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/tree.c,v
retrieving revision 1.281
diff -c -r1.281 tree.c
*** tree.c 29 Sep 2003 18:02:37 -0000 1.281
--- tree.c 3 Oct 2003 12:56:50 -0000
***************
*** 1963,1974 ****
xmlDeregisterNodeDefaultValue((xmlNodePtr)cur);
/* Check for ID removal -> leading to invalid references ! */
! if ((cur->parent != NULL) && (cur->parent->doc != NULL) &&
! ((cur->parent->doc->intSubset != NULL) ||
! (cur->parent->doc->extSubset != NULL))) {
! if (xmlIsID(cur->parent->doc, cur->parent, cur))
xmlRemoveID(cur->parent->doc, cur);
- }
if (cur->children != NULL) xmlFreeNodeList(cur->children);
DICT_FREE(cur->name)
xmlFree(cur);
--- 1963,1970 ----
xmlDeregisterNodeDefaultValue((xmlNodePtr)cur);
/* Check for ID removal -> leading to invalid references ! */
! if (cur->parent != NULL && xmlIsID(cur->parent->doc, cur->parent, cur))
xmlRemoveID(cur->parent->doc, cur);
if (cur->children != NULL) xmlFreeNodeList(cur->children);
DICT_FREE(cur->name)
xmlFree(cur);
***************
*** 3365,3370 ****
--- 3361,3368 ----
if (cur->type == XML_ATTRIBUTE_NODE) {
if (parent->properties == (xmlAttrPtr) cur)
parent->properties = ((xmlAttrPtr) cur)->next;
+ if (xmlIsID(cur->parent->doc, cur->parent, (xmlAttrPtr) cur))
+ xmlRemoveID(cur->parent->doc, (xmlAttrPtr) cur);
} else {
if (parent->children == cur)
parent->children = cur->next;
Index: valid.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/valid.c,v
retrieving revision 1.164
diff -c -r1.164 valid.c
*** valid.c 2 Oct 2003 22:28:07 -0000 1.164
--- valid.c 3 Oct 2003 12:56:54 -0000
***************
*** 2388,2405 ****
return(0);
}
! /**
! * xmlRemoveID:
! * @doc: the document
! * @attr: the attribute
! *
! * Remove the given attribute from the ID table maintained internally.
! *
! * Returns -1 if the lookup failed and 0 otherwise
! */
! int
! xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) {
! xmlAttrPtr cur;
xmlIDTablePtr table;
xmlChar *ID;
--- 2388,2395 ----
return(0);
}
! static int removeID(xmlDocPtr doc, xmlAttrPtr attr, int isStream) {
! xmlIDPtr cur;
xmlIDTablePtr table;
xmlChar *ID;
***************
*** 2410,2430 ****
return(-1);
if (attr == NULL)
! return(-1);
ID = xmlNodeListGetString(doc, attr->children, 1);
if (ID == NULL)
! return(-1);
cur = xmlHashLookup(table, ID);
! if (cur != attr) {
! xmlFree(ID);
! return(-1);
}
! xmlHashUpdateEntry(table, ID, NULL, (xmlHashDeallocator) xmlFreeID);
xmlFree(ID);
return(0);
}
/**
* xmlGetID:
* @doc: pointer to the document
* @ID: the ID value
--- 2400,2452 ----
return(-1);
if (attr == NULL)
! return(-1);
ID = xmlNodeListGetString(doc, attr->children, 1);
if (ID == NULL)
! return(-1);
cur = xmlHashLookup(table, ID);
! if (cur->attr == NULL || cur->attr != attr) {
! xmlFree(ID);
! return(-1);
}
! if (isStream == 1) {
! cur->attr = NULL;
! } else {
! xmlHashRemoveEntry(table, ID, (xmlHashDeallocator) xmlFreeID);
! }
xmlFree(ID);
return(0);
}
/**
+ * xmlRemoveID:
+ * @doc: the document
+ * @attr: the attribute
+ *
+ * Remove the given attribute from the ID table maintained internally.
+ *
+ * Returns -1 if the lookup failed and 0 otherwise
+ */
+ int
+ xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) {
+ return removeID(doc, attr, 0);
+ }
+
+ /**
+ * xmlReaderFreeID:
+ * @doc: the document
+ * @attr: the attribute
+ *
+ * Remove the given attribute from the ID table maintained internally.
+ *
+ * Returns -1 if the lookup failed and 0 otherwise
+ */
+ int
+ xmlReaderFreeID(xmlDocPtr doc, xmlAttrPtr attr) {
+ return removeID(doc, attr, 1);
+ }
+
+ /**
* xmlGetID:
* @doc: pointer to the document
* @ID: the ID value
Index: xmlreader.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/xmlreader.c,v
retrieving revision 1.71
diff -c -r1.71 xmlreader.c
*** xmlreader.c 1 Oct 2003 09:05:25 -0000 1.71
--- xmlreader.c 3 Oct 2003 12:56:57 -0000
***************
*** 185,191 ****
((cur->parent->doc->intSubset != NULL) ||
(cur->parent->doc->extSubset != NULL))) {
if (xmlIsID(cur->parent->doc, cur->parent, cur))
! xmlRemoveID(cur->parent->doc, cur);
}
if (cur->children != NULL)
xmlTextReaderFreeNodeList(reader, cur->children);
--- 185,191 ----
((cur->parent->doc->intSubset != NULL) ||
(cur->parent->doc->extSubset != NULL))) {
if (xmlIsID(cur->parent->doc, cur->parent, cur))
! xmlReaderFreeID(cur->parent->doc, cur);
}
if (cur->children != NULL)
xmlTextReaderFreeNodeList(reader, cur->children);
Index: doc/libxml2-api.xml
===================================================================
RCS file: /cvs/gnome/gnome-xml/doc/libxml2-api.xml,v
retrieving revision 1.72
diff -c -r1.72 libxml2-api.xml
*** doc/libxml2-api.xml 2 Oct 2003 22:28:08 -0000 1.72
--- doc/libxml2-api.xml 3 Oct 2003 12:57:18 -0000
***************
*** 948,953 ****
--- 948,954 ----
+
Index: include/libxml/valid.h
===================================================================
RCS file: /cvs/gnome/gnome-xml/include/libxml/valid.h,v
retrieving revision 1.45
diff -c -r1.45 valid.h
*** include/libxml/valid.h 29 Sep 2003 13:20:22 -0000 1.45
--- include/libxml/valid.h 3 Oct 2003 12:57:19 -0000
***************
*** 244,249 ****
--- 244,252 ----
XMLPUBFUN int XMLCALL
xmlRemoveID (xmlDocPtr doc,
xmlAttrPtr attr);
+ XMLPUBFUN int XMLCALL
+ xmlReaderFreeID (xmlDocPtr doc,
+ xmlAttrPtr attr);
/* IDREFs */
XMLPUBFUN xmlRefPtr XMLCALL