another set of patches from Anthony Jones for copy operations cleanup and

* valid.c tree.c entities.c: another set of patches from
  Anthony Jones for copy operations cleanup and robustness
Daniel
diff --git a/valid.c b/valid.c
index 55c7b9e..79f4cf9 100644
--- a/valid.c
+++ b/valid.c
@@ -1436,6 +1436,7 @@
 	return(NULL);
     }
     memset(cur, 0, sizeof(xmlAttribute));
+    cur->type = XML_ATTRIBUTE_DECL;
     cur->atype = attr->atype;
     cur->def = attr->def;
     cur->tree = xmlCopyEnumeration(attr->tree);
@@ -1443,6 +1444,8 @@
 	cur->elem = xmlStrdup(attr->elem);
     if (attr->name != NULL)
 	cur->name = xmlStrdup(attr->name);
+    if (attr->prefix != NULL)
+	cur->prefix = xmlStrdup(attr->prefix);
     if (attr->defaultValue != NULL)
 	cur->defaultValue = xmlStrdup(attr->defaultValue);
     return(cur);