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
diff --git a/ChangeLog b/ChangeLog
index 14ce3cc..0f064b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
 	Coninuing work on bug 118559
diff --git a/doc/downloads.html b/doc/downloads.html
index 701d3b6..0ce5553 100644
--- a/doc/downloads.html
+++ b/doc/downloads.html
@@ -9,7 +9,9 @@
 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
 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
 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
diff --git a/doc/encoding.html b/doc/encoding.html
index 28e935b..7e50d6f 100644
--- a/doc/encoding.html
+++ b/doc/encoding.html
@@ -92,7 +92,7 @@
 (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
 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>
   <li>the xml declaration if available is parsed, including the encoding
     declaration. At that point, if the autodetected encoding is different
diff --git a/doc/xml.html b/doc/xml.html
index de9fa90..2a9f8b5 100644
--- a/doc/xml.html
+++ b/doc/xml.html
@@ -2655,7 +2655,7 @@
 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>
   <li>the xml declaration if available is parsed, including the encoding
     declaration. At that point, if the autodetected encoding is different
diff --git a/result/valid/mixed_ns.xml b/result/valid/mixed_ns.xml
new file mode 100644
index 0000000..d8aedb8
--- /dev/null
+++ b/result/valid/mixed_ns.xml
@@ -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>
diff --git a/result/valid/mixed_ns.xml.err b/result/valid/mixed_ns.xml.err
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/result/valid/mixed_ns.xml.err
diff --git a/test/valid/mixed_ns.xml b/test/valid/mixed_ns.xml
new file mode 100644
index 0000000..22d8ed8
--- /dev/null
+++ b/test/valid/mixed_ns.xml
@@ -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>
diff --git a/valid.c b/valid.c
index d3dac10..9dee4bb 100644
--- a/valid.c
+++ b/valid.c
@@ -3717,20 +3717,34 @@
 		next = cur->c2;
 		while (next != NULL) {
 		    if (next->type == XML_ELEMENT_CONTENT_ELEMENT) {
-		        if (xmlStrEqual(next->name, name)) {
-			    VERROR(ctxt->userData, 
+		        if ((xmlStrEqual(next->name, name)) &&
+			    (xmlStrEqual(next->prefix, cur->prefix))) {
+			    if (cur->prefix == NULL) {
+				VERROR(ctxt->userData, 
 		   "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;
 			}
 			break;
 		    }
 		    if (next->c1 == NULL) break;
 		    if (next->c1->type != XML_ELEMENT_CONTENT_ELEMENT) break;
-		    if (xmlStrEqual(next->c1->name, name)) {
-			VERROR(ctxt->userData, 
-	       "Definition of %s has duplicate references of %s\n",
-			       elem->name, name);
+		    if ((xmlStrEqual(next->c1->name, name)) &&
+		        (xmlStrEqual(next->c1->prefix, cur->prefix))) {
+			if (cur->prefix == NULL) {
+			    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;
 		    }
 		    next = next->c2;