From 561ab9e739d6bf1a8d84f4607c578d60810067c2 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 23 Sep 2007 00:51:36 +0000 Subject: Fix dom_element_set_attribute() to use dom_attr_set_value() to replace the value of an existing attribute -- attribute values are stored as a tree of child nodes, not as a string attached to the nodeValue pointer. svn path=/trunk/dom/; revision=3580 --- src/core/element.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/element.c b/src/core/element.c index 16c6932..0d23347 100644 --- a/src/core/element.c +++ b/src/core/element.c @@ -253,12 +253,11 @@ dom_exception dom_element_set_attribute(struct dom_element *element, if (a != NULL) { /* Found an existing attribute, so replace its value */ - if (a->value != NULL) - dom_string_unref(a->value); + dom_exception err; - if (value != NULL) - dom_string_ref(value); - a->value = value; + err = dom_attr_set_value((struct dom_attr *) a, value); + if (err != DOM_NO_ERR) + return err; } else { /* No existing attribute, so create one */ dom_exception err; -- cgit v1.2.3