[libxml2] Fix the spurious ID already defined error
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fix the spurious ID already defined error
- Date: Thu, 10 Sep 2015 11:47:44 +0000 (UTC)
commit ef709ce2f7b792d5fb69ed142796d743fb1eb388
Author: Daniel Veillard <veillard redhat com>
Date: Thu Sep 10 19:41:41 2015 +0800
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
result/valid/737840.xml | 10 ++++++++++
test/valid/737840.xml | 10 ++++++++++
test/valid/dtds/737840.ent | 1 +
valid.c | 6 ++++--
4 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/result/valid/737840.xml b/result/valid/737840.xml
new file mode 100644
index 0000000..433c6d6
--- /dev/null
+++ b/result/valid/737840.xml
@@ -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>
+ ⌖
+</root>
diff --git a/result/valid/737840.xml.err b/result/valid/737840.xml.err
new file mode 100644
index 0000000..e69de29
diff --git a/result/valid/737840.xml.err.rdr b/result/valid/737840.xml.err.rdr
new file mode 100644
index 0000000..e69de29
diff --git a/test/valid/737840.xml b/test/valid/737840.xml
new file mode 100644
index 0000000..2d27b73
--- /dev/null
+++ b/test/valid/737840.xml
@@ -0,0 +1,10 @@
+<!DOCTYPE root [
+<!ELEMENT root (elem)>
+<!ELEMENT elem (#PCDATA)>
+<!ATTLIST elem id ID #IMPLIED>
+<!ENTITY target SYSTEM "dtds/737840.ent">
+]>
+
+<root>
+ ⌖
+</root>
diff --git a/test/valid/dtds/737840.ent b/test/valid/dtds/737840.ent
new file mode 100644
index 0000000..e972132
--- /dev/null
+++ b/test/valid/dtds/737840.ent
@@ -0,0 +1 @@
+<elem id="id0"/>
\ No newline at end of file
diff --git a/valid.c b/valid.c
index 409aa81..45a3f70 100644
--- a/valid.c
+++ b/valid.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]