1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-24 21:33:51 +03:00

Fix the spurious ID already defined error

For https://bugzilla.gnome.org/show_bug.cgi?id=737840
the fix for 724903 introduced a regression on external entities carrying
IDs, revert that patch in part and add a specific test to avoid readding it
This commit is contained in:
Daniel Veillard 2015-09-10 19:41:41 +08:00
parent 3eaedba1b6
commit ef709ce2f7
6 changed files with 25 additions and 2 deletions

10
result/valid/737840.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE root [
<!ELEMENT root (elem)>
<!ELEMENT elem (#PCDATA)>
<!ATTLIST elem id ID #IMPLIED>
<!ENTITY target SYSTEM "dtds/737840.ent">
]>
<root>
&target;
</root>

View File

View File

10
test/valid/737840.xml Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE root [
<!ELEMENT root (elem)>
<!ELEMENT elem (#PCDATA)>
<!ATTLIST elem id ID #IMPLIED>
<!ENTITY target SYSTEM "dtds/737840.ent">
]>
<root>
&target;
</root>

View File

@ -0,0 +1 @@
<elem id="id0"/>

View File

@ -2634,8 +2634,10 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
/*
* The id is already defined in this DTD.
*/
xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
"ID %s already defined\n", value, NULL, NULL);
if (ctxt != NULL) {
xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
"ID %s already defined\n", value, NULL, NULL);
}
#endif /* LIBXML_VALID_ENABLED */
xmlFreeID(ret);
return(NULL);