Re: Changing the prefix of a default attribute (Attr.specified false)

On Tue, Feb 20, 2001 at 09:25:31AM -0500, Joseph Kesselman wrote:
> 
> >Changing the value of a default attribute (Attr.specified = false) will
> >change it to a specified attribute,
> 
> Good point; I think we completely missed that.
> 
> My reading is that this depends on whether the default came from a DTD or a
> namespace-aware schema language.
> 
> If it came from a DTD, the default is bound to the specific QName.
> Therefore, changing the prefix should be roughly equivalent to removing the
> existing attribute and instantiating a new one with the new name... and
> there should be two results. The first is that this Attr object should now
> be considered Specified.  The other is that the default should be
> reasserted under the original QName.

This is interesting.

I would assume that once the default Attr is in the tree, it has received
a namespaceURI. Changing the prefix will not change said namespaceURI. In
other words, the Attr is no longer bound by its qualified name, but by
it's namespaceURI and localname.

If this wasn't the case, the reasserted default Attr Node would receive
the same namespaceURI, thus representing the same attribute. This would
result in an Element Node with inconsistent contents; you don't know which
Attr would be returned on a attributes.getNamedItemNS() or
getAttributeNS() call, for instance.

<SNIP>

> This is personal opinon, subject to confirmation or rejection by the rest
> of the DOM committee.

Okay, I created an issue in our issue tracker on this, until an official
statement has been made on the issue.

-- 
Martijn Pieters
| Software Engineer  mailto:mj@digicool.com
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
---------------------------------------------

Received on Tuesday, 20 February 2001 15:35:10 UTC