[libxml2] 446613 small validation bug mixed content with NS
- From: Daniel Veillard <veillard src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libxml2] 446613 small validation bug mixed content with NS
- Date: Fri, 21 Aug 2009 16:25:21 +0000 (UTC)
commit a721612e54605ed15e3fd6a54a962e947523ba43
Author: Daniel Veillard <veillard redhat com>
Date: Fri Aug 21 18:22:58 2009 +0200
446613 small validation bug mixed content with NS
* valid.c: fix a bug when valdating mixed content lists and some
name use namespaces prefixes.
* result/valid/notes.xml* test/valid/dtds/notes.dtd * test/valid/notes.xml:
add the test case to the regression suite
result/valid/notes.xml | 3 +++
test/valid/dtds/notes.dtd | 19 +++++++++++++++++++
test/valid/notes.xml | 5 +++++
valid.c | 12 ++++++------
4 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/result/valid/notes.xml b/result/valid/notes.xml
new file mode 100644
index 0000000..6ab3aa3
--- /dev/null
+++ b/result/valid/notes.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE notes SYSTEM "dtds/notes.dtd">
+<pfx:notes xmlns:pfx="http://namespace/uri/here"><note/><pfx:note/></pfx:notes>
diff --git a/result/valid/notes.xml.err b/result/valid/notes.xml.err
new file mode 100644
index 0000000..e69de29
diff --git a/test/valid/dtds/notes.dtd b/test/valid/dtds/notes.dtd
new file mode 100644
index 0000000..b40a8ac
--- /dev/null
+++ b/test/valid/dtds/notes.dtd
@@ -0,0 +1,19 @@
+<!--
+This gets parsed without complaint:
+<!ELEMENT pfx:notes ( #PCDATA | note | pfx:note )* >
+-->
+
+<!--
+This triggers a diagnostic:
+notes.dtd:13: validity error : Definition of notes has duplicate
+references of note
+<!ELEMENT pfx:notes ( #PCDATA | pfx:note | note )* >
+-->
+
+<!ELEMENT pfx:notes ( #PCDATA | pfx:note | note )* >
+
+<!ATTLIST notes
+ xmlns:pfx CDATA #FIXED 'http://namespace/uri/here'
+>
+<!ELEMENT note EMPTY >
+<!ELEMENT pfx:note EMPTY >
diff --git a/test/valid/notes.xml b/test/valid/notes.xml
new file mode 100644
index 0000000..157d178
--- /dev/null
+++ b/test/valid/notes.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE notes SYSTEM "dtds/notes.dtd">
+<pfx:notes
+xmlns:pfx="http://namespace/uri/here"
+><note/><pfx:note/></pfx:notes>
diff --git a/valid.c b/valid.c
index 81e2fea..eb39616 100644
--- a/valid.c
+++ b/valid.c
@@ -4257,15 +4257,15 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
while (next != NULL) {
if (next->type == XML_ELEMENT_CONTENT_ELEMENT) {
if ((xmlStrEqual(next->name, name)) &&
- (xmlStrEqual(next->prefix, cur->prefix))) {
- if (cur->prefix == NULL) {
+ (xmlStrEqual(next->prefix, cur->c1->prefix))) {
+ if (cur->c1->prefix == NULL) {
xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
"Definition of %s has duplicate references of %s\n",
elem->name, name, NULL);
} else {
xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
"Definition of %s has duplicate references of %s:%s\n",
- elem->name, cur->prefix, name);
+ elem->name, cur->c1->prefix, name);
}
ret = 0;
}
@@ -4274,15 +4274,15 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
if (next->c1 == NULL) break;
if (next->c1->type != XML_ELEMENT_CONTENT_ELEMENT) break;
if ((xmlStrEqual(next->c1->name, name)) &&
- (xmlStrEqual(next->c1->prefix, cur->prefix))) {
- if (cur->prefix == NULL) {
+ (xmlStrEqual(next->c1->prefix, cur->c1->prefix))) {
+ if (cur->c1->prefix == NULL) {
xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
"Definition of %s has duplicate references to %s\n",
elem->name, name, NULL);
} else {
xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
"Definition of %s has duplicate references to %s:%s\n",
- elem->name, cur->prefix, name);
+ elem->name, cur->c1->prefix, name);
}
ret = 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]