fixed bug #76168, attribute redeclared in the internal subset should not

* valid.c SAX.c: fixed bug #76168, attribute redeclared in
  the internal subset should not raise duplicate ID errors,
  also there was a small bug in conjunction to namespace
  declarations defaulted and xml:xxx attributes DTD definitions.
Daniel
diff --git a/ChangeLog b/ChangeLog
index b9c32e9..8b6247b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Mar 25 11:46:05 CET 2002 Daniel Veillard <daniel@veillard.com>
+
+	* valid.c SAX.c: fixed bug #76168, attribute redeclared in
+	  the internal subset should not raise duplicate ID errors,
+	  also there was a small bug in conjunction to namespace
+	  declarations defaulted and xml:xxx attributes DTD definitions.
+	  
 Fri Mar 22 15:13:49 CET 2002 Daniel Veillard <daniel@veillard.com>
 
 	* xpath.c: Richard Jinks also raised some rounding problems
diff --git a/SAX.c b/SAX.c
index 5fc3463..bcc8089 100644
--- a/SAX.c
+++ b/SAX.c
@@ -520,8 +520,8 @@
     }
     if (ctxt->vctxt.valid == 0)
 	ctxt->valid = 0;
-    if (ctxt->validate && ctxt->wellFormed &&
-        ctxt->myDoc && ctxt->myDoc->intSubset)
+    if ((attr != NULL) && (ctxt->validate) && (ctxt->wellFormed) &&
+        (ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset != NULL))
 	ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc,
 	                                        attr);
     if (prefix != NULL)
@@ -1248,7 +1248,7 @@
     }
 
     /*
-     * process all the attributes whose name start with "xml"
+     * process all the attributes whose name start with "xmlns"
      */
     if (atts != NULL) {
         i = 0;
@@ -1256,7 +1256,8 @@
 	value = atts[i++];
 	if (!ctxt->html) {
 	    while ((att != NULL) && (value != NULL)) {
-		if ((att[0] == 'x') && (att[1] == 'm') && (att[2] == 'l'))
+		if ((att[0] == 'x') && (att[1] == 'm') && (att[2] == 'l') &&
+		    (att[3] == 'n') && (att[4] == 's'))
 		    attribute(ctxt, att, value);
 
 		att = atts[i++];
diff --git a/configure.in b/configure.in
index e4f0c11..476cc3e 100644
--- a/configure.in
+++ b/configure.in
@@ -87,7 +87,7 @@
 AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h)
 AC_CHECK_HEADERS(stdlib.h sys/socket.h netinet/in.h arpa/inet.h)
 AC_CHECK_HEADERS(netdb.h sys/time.h sys/select.h sys/mman.h)
-AC_CHECK_HEADERS(sys/timeb.h signal.h)
+AC_CHECK_HEADERS(sys/timeb.h signal.h resolv.h)
 
 dnl Specific dir for HTML output ?
 if test "x$with_html_dir" = "x" ; then
diff --git a/libxml.spec.in b/libxml.spec.in
index 8d13a18..5a9fa5e 100644
--- a/libxml.spec.in
+++ b/libxml.spec.in
@@ -1,7 +1,7 @@
 Summary: Library providing XML and HTML support
 Name: libxml2
 Version: @VERSION@
-Release: 1
+Release: 4
 License: MIT
 Group: Development/Libraries
 Source: ftp://xmlsoft.org/libxml2-%{version}.tar.gz
diff --git a/nanohttp.c b/nanohttp.c
index b843370..f0d3062 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -39,6 +39,9 @@
 #ifdef HAVE_NETDB_H
 #include <netdb.h>
 #endif
+#ifdef HAVE_RESOLV_H
+#include <resolv.h>
+#endif
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h> 
 #endif
diff --git a/valid.c b/valid.c
index 36f2bec..1f1845d 100644
--- a/valid.c
+++ b/valid.c
@@ -1262,6 +1262,7 @@
 	xmlFreeEnumeration(tree);
 	return(NULL);
     }
+
     /*
      * Check the type and possibly the default value.
      */
@@ -1301,6 +1302,18 @@
     }
 
     /*
+     * Check first that an attribute defined in the external subset wasn't
+     * already defined in the internal subset
+     */
+    if ((dtd->doc != NULL) && (dtd->doc->extSubset == dtd) &&
+	(dtd->doc->intSubset != NULL) &&
+	(dtd->doc->intSubset->attributes != NULL)) {
+        ret = xmlHashLookup3(dtd->doc->intSubset->attributes, name, ns, elem);
+	if (ret != NULL)
+	    return(NULL);
+    }
+
+    /*
      * Create the Attribute table if needed.
      */
     table = (xmlAttributeTablePtr) dtd->attributes;
@@ -3369,6 +3382,9 @@
     if ((elem == NULL) || (elem->name == NULL)) return(0);
     if ((attr == NULL) || (attr->name == NULL)) return(0);
 
+    if (xmlStrEqual(attr->name, "lang")) {
+	printf("hello\n");
+    }
     if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) {
 	xmlChar qname[500];
 	snprintf((char *) qname, sizeof(qname), "%s:%s",