diff --git a/tree.c b/tree.c index a93f2e31..e4fd0d6e 100644 --- a/tree.c +++ b/tree.c @@ -1691,8 +1691,8 @@ xmlFreeProp(xmlAttr *cur) { xmlDeregisterNodeDefaultValue((xmlNodePtr)cur); /* Check for ID removal -> leading to invalid references ! */ - if ((cur->doc != NULL) && (cur->atype == XML_ATTRIBUTE_ID)) { - xmlRemoveID(cur->doc, cur); + if (cur->doc != NULL && cur->id != NULL) { + xmlRemoveID(cur->doc, cur); } if (cur->children != NULL) xmlFreeNodeList(cur->children); DICT_FREE(cur->name) @@ -2503,7 +2503,7 @@ xmlNodeSetDoc(xmlNodePtr node, xmlDocPtr doc) { * TODO: ID attributes should also be added to the new * document, but it's not clear how to handle clashes. */ - if (attr->atype == XML_ATTRIBUTE_ID) + if (attr->id != NULL) xmlRemoveID(oldDoc, attr); break; @@ -6569,7 +6569,7 @@ xmlSetNsProp(xmlNode *node, xmlNs *ns, const xmlChar *name, return(NULL); } - if (prop->atype == XML_ATTRIBUTE_ID) { + if (prop->id != NULL) { xmlRemoveID(node->doc, prop); prop->atype = XML_ATTRIBUTE_ID; } diff --git a/valid.c b/valid.c index e11d2c95..17cf1137 100644 --- a/valid.c +++ b/valid.c @@ -3945,7 +3945,7 @@ xmlValidateOneAttribute(xmlValidCtxt *ctxt, xmlDoc *doc, attr->name, elem->name, NULL); return(0); } - if (attr->atype == XML_ATTRIBUTE_ID) + if (attr->id != NULL) xmlRemoveID(doc, attr); attr->atype = attrDecl->atype;