NamedNodeMap

The DOM2 draft prescribes to raise an INUSE_ATTRIBUTE_ERR on the
setNamedItem an setNamedItemNS methods if "arg is an Attr that is
already an attribute of another Element object".  This probably
suggests, not to raise such an exception, if Attr is already an
attribute of the "same" Element object. But the question here is, how
a NamedNodeMap can "know" that it is attached to an Element (and to
which Element), so that it makes sense to use here any possessive
pronoun at all.

Conclusion:  One should either modify the directions of raising an
INUSE_ATTRIBUTE_ERR into "Raised if arg is an Attr that is already an
attribute of an Element object. ..." and (depending what the desired
behavior should be) add to the description of the function "Adds a
node using its nodeName attribute. If arg is already present in the
map nothing is done and the method returns null.", or introduce an
ownerNode attribute on the NamedNodeMap interface which can be used to
determine to which Element the NamedNodeMap belongs or whether it is
used by an application for some other purpose.

The last suggestion fixes also a problem that arises on setting the
ownerElement attribute of an attribute node:  If one uses the
setAttribute method of the element interface the value of the
ownerElement can easily determined, because it is the object which
calls the method.  But if one uses
NamedNodeMap.setNamedItem(MyAttribute) the information to which
Element the NamedNodeMap possibly belongs is not available (unless it
has an ownerNode attribute), and so MyAttribute.ownerElement cannot be
set correctly.

BTW: Should not the createElementNS method of the Document interface
raise an NAMESPACE_ERR if the qualifiedName has a prefix that is
"xmlns" but the namespaceURI is neither null nor an empty string? 

-- 
=====================================================================
 Dieter Koehler, M. A. - dieter.koehler@ppp.uni-bamberg.de
 Mittlere Kaulberg 22, D-96049 Bamberg, +49(0)951-5190726
 "http://www.philo.de/Philosophie-Seiten/": 1000+ Philosophie-Links
 "http://www.philo.de/VirtualLibrary/14.de.htm": Deutsche Philo-Links
 "http://www.philo.de/xml/": Open XML - XML-Komponenten fuer Delphi
=====================================================================

Received on Saturday, 4 March 2000 13:27:58 UTC