fix issue adding non-namespaced attributes in xmlAddChild(),
* tree.c: fix issue adding non-namespaced attributes in xmlAddChild(),
xmlAddNextSibling() and xmlAddPrevSibling() (bug #319108) - part 1.
diff --git a/ChangeLog b/ChangeLog
index 8772b3a..c7f29cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Oct 24 20:16:23 EDT 2005 Rob Richards <rrichards@ctindustries.net>
+
+ * tree.c: fix issue adding non-namespaced attributes in xmlAddChild(),
+ xmlAddNextSibling() and xmlAddPrevSibling() (bug #319108) - part 1.
+
Sat Oct 22 10:00:41 HKT 2005 William Brack <wbrack@mmm.com.hk>
* parser.c: fixed second spot where CRLF split between chunks
diff --git a/tree.c b/tree.c
index fa7785b..aba96a1 100644
--- a/tree.c
+++ b/tree.c
@@ -2855,10 +2855,11 @@
xmlAttrPtr attr;
if (elem->ns == NULL)
- attr = xmlHasProp(cur->parent, elem->name);
+ attr = xmlHasNsProp(cur->parent, elem->name, NULL);
else
attr = xmlHasNsProp(cur->parent, elem->name, elem->ns->href);
- if ((attr != NULL) && (attr != (xmlAttrPtr) elem)) {
+ /* elem has already been unlinked so can never be attr */
+ if ((attr != NULL) && (attr->type != XML_ATTRIBUTE_DECL)) {
/* different instance, destroy it (attributes must be unique) */
xmlFreeProp(attr);
}
@@ -2935,10 +2936,11 @@
xmlAttrPtr attr;
if (elem->ns == NULL)
- attr = xmlHasProp(cur->parent, elem->name);
+ attr = xmlHasNsProp(cur->parent, elem->name, NULL);
else
attr = xmlHasNsProp(cur->parent, elem->name, elem->ns->href);
- if ((attr != NULL) && (attr != (xmlAttrPtr) elem)) {
+ /* elem has already been unlinked so can never be attr */
+ if ((attr != NULL) && (attr->type != XML_ATTRIBUTE_DECL)) {
/* different instance, destroy it (attributes must be unique) */
xmlFreeProp(attr);
}
@@ -3203,10 +3205,10 @@
xmlAttrPtr lastattr;
if (cur->ns == NULL)
- lastattr = xmlHasProp(parent, cur->name);
+ lastattr = xmlHasNsProp(parent, cur->name, NULL);
else
lastattr = xmlHasNsProp(parent, cur->name, cur->ns->href);
- if ((lastattr != NULL) && (lastattr != (xmlAttrPtr) cur)) {
+ if ((lastattr != NULL) && (lastattr != (xmlAttrPtr) cur) && (lastattr->type != XML_ATTRIBUTE_DECL)) {
/* different instance, destroy it (attributes must be unique) */
xmlFreeProp(lastattr);
}