setAttributeNS vs. setAttributeNodeNS

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:

	attr.setValue("foo");
	element.setAttributeNodeNS(attr);
	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.

	Keith

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