W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2000

setAttributeNS vs. setAttributeNodeNS

From: Keith W. Boone <kboone@ebt.com>
Date: Tue, 21 Mar 2000 09:40:02 -0500
To: <www-dom@w3.org>
Message-ID: <003401bf9343$57e06980$767770c6@ebt.com>
In reading the specification for setAttributeNS vs. setAttributeNodeNS, I
have a question about the distinctions made between changing and replacing
nodes in these two methods.

setAttributeNS indicates that:
If an attribute with the same local name and Namespace URI is already
present on the element, its prefix is changed to be ...

whereas setAttributeNodeNS indicates that:
If an attribute with that local name and Namespace URI is already present in
the element, it is replaced by the new one.

Assuming the following Java statements are executed:

	element.setAttributeNS(attr.getNamespaceURI(), attr.getName(), "bar");

What will be returned by attr.getValue()?
According to the specification, it appears that the value must be "bar".  Is
this intentional, or can it be up to the implementation whether an existing
attribute is changed or replaced with a new attribute.

Received on Tuesday, 21 March 2000 09:40:31 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:06 UTC