- added xmlRemoveProp
- changed the way Windows socket stuff get included
- removed an indetermination xmLDecl/PI(xml...)
- xmlNewNs wasn't checking for double definition
- fixed a problem with dist-hook duplicates
- fixed the loading of external entities APIs, now xmlLoadExternalEntity()
  is used everywhere
- now the xhtml spec validates with the xhtml DTD.
- error.c: fixed crashes in case of no input stream
- added the xhtml spec and dtds to the validation tests and results
Daniel
diff --git a/tree.c b/tree.c
index c6685ea..bbeb90b 100644
--- a/tree.c
+++ b/tree.c
@@ -116,8 +116,10 @@
  * @href:  the URI associated
  * @prefix:  the prefix for the namespace
  *
- * Creation of a new Namespace.
- * Returns returns a new namespace pointer
+ * Creation of a new Namespace. This function will refuse to create
+ * a namespace with a similar prefix than an existing one present on this
+ * node.
+ * Returns returns a new namespace pointer or NULL
  */
 xmlNsPtr
 xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) {
@@ -149,6 +151,7 @@
 
     /*
      * Add it at the end to preserve parsing order ...
+     * and checks for existing use of the prefix
      */
     cur->next = NULL;
     if (node != NULL) {
@@ -157,11 +160,17 @@
 	} else {
 	    xmlNsPtr prev = node->nsDef;
 
-	    while (prev->next != NULL) prev = prev->next;
+	    while (prev->next != NULL) {
+		if (((prev->prefix == NULL) && (cur->prefix == NULL)) ||
+		    (!xmlStrcmp(prev->prefix, cur->prefix))) {
+		    xmlFreeNs(cur);
+		    return(NULL);
+		}    
+	        prev = prev->next;
+	    }
 	    prev->next = cur;
 	}
     }
-
     return(cur);
 }
 
@@ -171,48 +180,14 @@
  * @href:  the URI associated
  * @prefix:  the prefix for the namespace
  *
- * Creation of a Namespace, the old way using PI and without scoping, to AVOID.
- * Returns returns a new namespace pointer
+ * Creation of a Namespace, the old way using PI and without scoping
+ *   DEPRECATED !!!
+ * Will be removed at next major release !
+ * Returns NULL this functionnality had been removed
  */
 xmlNsPtr
 xmlNewGlobalNs(xmlDocPtr doc, const xmlChar *href, const xmlChar *prefix) {
-    xmlNsPtr cur;
-
-    /*
-     * Allocate a new DTD and fill the fields.
-     */
-    cur = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
-    if (cur == NULL) {
-        fprintf(stderr, "xmlNewGlobalNs : malloc failed\n");
-	return(NULL);
-    }
-
-    cur->type = XML_GLOBAL_NAMESPACE;
-    if (href != NULL)
-	cur->href = xmlStrdup(href); 
-    else
-        cur->href = NULL;
-    if (prefix != NULL)
-	cur->prefix = xmlStrdup(prefix); 
-    else
-        cur->prefix = NULL;
-
-    /*
-     * Add it at the end to preserve parsing order ...
-     */
-    cur->next = NULL;
-    if (doc != NULL) {
-	if (doc->oldNs == NULL) {
-	    doc->oldNs = cur;
-	} else {
-	    xmlNsPtr prev = doc->oldNs;
-
-	    while (prev->next != NULL) prev = prev->next;
-	    prev->next = cur;
-	}
-    }
-
-    return(cur);
+    return(NULL);
 }
 
 /**
@@ -956,9 +931,9 @@
 
 /**
  * xmlFreeProp:
- * @cur:  the first property in the list
+ * @cur:  an attribute
  *
- * Free one property, all the childs are freed too.
+ * Free one attribute, all the content is freed too
  */
 void
 xmlFreeProp(xmlAttrPtr cur) {
@@ -973,6 +948,44 @@
 }
 
 /**
+ * xmlRemoveProp:
+ * @cur:  an attribute
+ *
+ * Unlink and free one attribute, all the content is freed too
+ * Note this doesn't work for namespace definition attributes
+ *
+ * Returns 0 if success and -1 in case of error.
+ */
+int
+xmlRemoveProp(xmlAttrPtr cur) {
+    xmlAttrPtr tmp;
+    if (cur == NULL) {
+        fprintf(stderr, "xmlRemoveProp : cur == NULL\n");
+	return(-1);
+    }
+    if (cur->node == NULL) {
+        fprintf(stderr, "xmlRemoveProp : cur->node == NULL\n");
+	return(-1);
+    }
+    tmp = cur->node->properties;
+    if (tmp == cur) {
+        cur->node->properties = cur->next;
+	xmlFreeProp(cur);
+	return(0);
+    }
+    while (tmp != NULL) {
+	if (tmp->next == cur) {
+	    tmp->next = cur->next;
+	    xmlFreeProp(cur);
+	    return(0);
+	}
+        tmp = tmp->next;
+    }
+    fprintf(stderr, "xmlRemoveProp : attribute not owned by its node\n");
+    return(-1);
+}
+
+/**
  * xmlNewPI:
  * @name:  the processing instruction name
  * @content:  the PI content