1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

fixed bug #118712 about mixed content, and namespaced element names. added

* valid.c: fixed bug #118712 about mixed content, and namespaced
  element names.
* test/valid/mixed_ns.xml result/valid/mixed_ns*: added a check
  in the regression tests
Daniel
This commit is contained in:
Daniel Veillard
2003-08-03 22:58:54 +00:00
parent 779af00750
commit 7b68df974b
8 changed files with 65 additions and 10 deletions

View File

@ -1,3 +1,10 @@
Sun Aug 3 18:56:54 EDT 2003 Daniel Veillard <daniel@veillard.com>
* valid.c: fixed bug #118712 about mixed content, and namespaced
element names.
* test/valid/mixed_ns.xml result/valid/mixed_ns*: added a check
in the regression tests
Fri Aug 1 23:55:23 HKT 2003 William Brack <wbrack@mmm.com.hk> Fri Aug 1 23:55:23 HKT 2003 William Brack <wbrack@mmm.com.hk>
Coninuing work on bug 118559 Coninuing work on bug 118559

View File

@ -9,7 +9,9 @@ H3 {font-family: Verdana,Arial,Helvetica}
A:link, A:visited, A:active { text-decoration: underline } A:link, A:visited, A:active { text-decoration: underline }
</style><title>Downloads</title></head><body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XML C parser and toolkit of Gnome</h1><h2>Downloads</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="intro.html">Introduction</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="docs.html">Developer Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="news.html">News</a></li><li><a href="XMLinfo.html">XML</a></li><li><a href="XSLT.html">XSLT</a></li><li><a href="xmldtd.html">Validation &amp; DTDs</a></li><li><a href="encoding.html">Encodings support</a></li><li><a href="catalog.html">Catalog support</a></li><li><a href="namespaces.html">Namespaces</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="guidelines.html">XML Guidelines</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml&amp;product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>The latest versions of libxml2 can be found on <a href="ftp://xmlsoft.org/">xmlsoft.org</a> (<a href="ftp://speakeasy.rpmfind.net/pub/libxml/">Seattle</a>, <a href="ftp://fr.rpmfind.net/pub/libxml/">France</a>) or on the <a href="ftp://ftp.gnome.org/pub/GNOME/MIRRORS.html">Gnome FTP server</a> either </style><title>Downloads</title></head><body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XML C parser and toolkit of Gnome</h1><h2>Downloads</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="intro.html">Introduction</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="docs.html">Developer Documentation</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="news.html">News</a></li><li><a href="XMLinfo.html">XML</a></li><li><a href="XSLT.html">XSLT</a></li><li><a href="xmldtd.html">Validation &amp; DTDs</a></li><li><a href="encoding.html">Encodings support</a></li><li><a href="catalog.html">Catalog support</a></li><li><a href="namespaces.html">Namespaces</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="guidelines.html">XML Guidelines</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml&amp;product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>The latest versions of libxml2 can be found on <a href="ftp://xmlsoft.org/">xmlsoft.org</a> (<a href="ftp://speakeasy.rpmfind.net/pub/libxml/">Seattle</a>, <a href="ftp://fr.rpmfind.net/pub/libxml/">France</a>) or on the <a href="ftp://ftp.gnome.org/pub/GNOME/MIRRORS.html">Gnome FTP server</a> either
as a <a href="ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.5/">source as a <a href="ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.5/">source
archive</a> archive</a><!-- commenting this out because they seem to have disappeared or <a
href="ftp://ftp.gnome.org/pub/GNOME/stable/redhat/i386/libxml/">RPM
packages</a> -->
, Antonin Sprinzl also provide <a href="ftp://gd.tuwien.ac.at/pub/libxml/">a , Antonin Sprinzl also provide <a href="ftp://gd.tuwien.ac.at/pub/libxml/">a
mirror in Austria</a>. (NOTE that you need both the <a href="http://rpmfind.net/linux/RPM/libxml2.html">libxml(2)</a> and <a href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml(2)-devel</a> mirror in Austria</a>. (NOTE that you need both the <a href="http://rpmfind.net/linux/RPM/libxml2.html">libxml(2)</a> and <a href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml(2)-devel</a>
packages installed to compile applications using libxml.)</p><p>Binary ports:</p><ul><li>Red Hat RPMs for i386 are available directly on <a href="ftp://xmlsoft.org/">xmlsoft.org</a>, the source RPM will compile on packages installed to compile applications using libxml.)</p><p>Binary ports:</p><ul><li>Red Hat RPMs for i386 are available directly on <a href="ftp://xmlsoft.org/">xmlsoft.org</a>, the source RPM will compile on

View File

@ -92,7 +92,7 @@ rationale for those choices:</p><ul><li>keeping the native encoding in the inter
(internationalization) support get triggered only during I/O operation, i.e. (internationalization) support get triggered only during I/O operation, i.e.
when reading a document or saving one. Let's look first at the reading when reading a document or saving one. Let's look first at the reading
sequence:</p><ol><li>when a document is processed, we usually don't know the encoding, a sequence:</p><ol><li>when a document is processed, we usually don't know the encoding, a
simple heuristic allows to detect UTF-18 and UCS-4 from whose where the simple heuristic allows to detect UTF-16 and UCS-4 from whose where the
ASCII range (0-0x7F) maps with ASCII</li> ASCII range (0-0x7F) maps with ASCII</li>
<li>the xml declaration if available is parsed, including the encoding <li>the xml declaration if available is parsed, including the encoding
declaration. At that point, if the autodetected encoding is different declaration. At that point, if the autodetected encoding is different

View File

@ -2655,7 +2655,7 @@ when reading a document or saving one. Let's look first at the reading
sequence:</p> sequence:</p>
<ol> <ol>
<li>when a document is processed, we usually don't know the encoding, a <li>when a document is processed, we usually don't know the encoding, a
simple heuristic allows to detect UTF-18 and UCS-4 from whose where the simple heuristic allows to detect UTF-16 and UCS-4 from whose where the
ASCII range (0-0x7F) maps with ASCII</li> ASCII range (0-0x7F) maps with ASCII</li>
<li>the xml declaration if available is parsed, including the encoding <li>the xml declaration if available is parsed, including the encoding
declaration. At that point, if the autodetected encoding is different declaration. At that point, if the autodetected encoding is different

16
result/valid/mixed_ns.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!DOCTYPE a [
<!ELEMENT a (#PCDATA | b | s:b)*>
<!ATTLIST a xmlns:s CDATA #IMPLIED>
<!ELEMENT b EMPTY>
<!ATTLIST b xmlns:s CDATA #IMPLIED>
<!ELEMENT s:b EMPTY>
<!ATTLIST s:b xmlns:s CDATA #IMPLIED>
]>
<a xmlns:s="http://some.test.ns/a">
Some text.
<b/>
Some text.
<s:b/>
Some text.
</a>

View File

16
test/valid/mixed_ns.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!DOCTYPE a [
<!ELEMENT a (#PCDATA|b|s:b)*>
<!ATTLIST a xmlns:s CDATA #IMPLIED>
<!ELEMENT b EMPTY>
<!ATTLIST b xmlns:s CDATA #IMPLIED>
<!ELEMENT s:b EMPTY>
<!ATTLIST s:b xmlns:s CDATA #IMPLIED>
]>
<a xmlns:s="http://some.test.ns/a">
Some text.
<b/>
Some text.
<s:b/>
Some text.
</a>

28
valid.c
View File

@ -3717,20 +3717,34 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
next = cur->c2; next = cur->c2;
while (next != NULL) { while (next != NULL) {
if (next->type == XML_ELEMENT_CONTENT_ELEMENT) { if (next->type == XML_ELEMENT_CONTENT_ELEMENT) {
if (xmlStrEqual(next->name, name)) { if ((xmlStrEqual(next->name, name)) &&
VERROR(ctxt->userData, (xmlStrEqual(next->prefix, cur->prefix))) {
if (cur->prefix == NULL) {
VERROR(ctxt->userData,
"Definition of %s has duplicate references of %s\n", "Definition of %s has duplicate references of %s\n",
elem->name, name); elem->name, name);
} else {
VERROR(ctxt->userData,
"Definition of %s has duplicate references of %s:%s\n",
elem->name, cur->prefix, name);
}
ret = 0; ret = 0;
} }
break; break;
} }
if (next->c1 == NULL) break; if (next->c1 == NULL) break;
if (next->c1->type != XML_ELEMENT_CONTENT_ELEMENT) break; if (next->c1->type != XML_ELEMENT_CONTENT_ELEMENT) break;
if (xmlStrEqual(next->c1->name, name)) { if ((xmlStrEqual(next->c1->name, name)) &&
VERROR(ctxt->userData, (xmlStrEqual(next->c1->prefix, cur->prefix))) {
"Definition of %s has duplicate references of %s\n", if (cur->prefix == NULL) {
elem->name, name); VERROR(ctxt->userData,
"Definition of %s has duplicate references to %s\n",
elem->name, name);
} else {
VERROR(ctxt->userData,
"Definition of %s has duplicate references to %s:%s\n",
elem->name, cur->prefix, name);
}
ret = 0; ret = 0;
} }
next = next->c2; next = next->c2;