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

namespace treatment, 2nd attempt

From: Dieter Köhler <dieter.koehler@ppp.uni-bamberg.de>
Date: Thu, 09 Mar 2000 02:35:41 +0100
Message-ID: <38C6FFED.19488B21@ppp.uni-bamberg.de>
To: "www-dom@w3.org" <www-dom@w3.org>
The namespace problem with Attributes grants me no rest.  Since the
new DOM2 draft came up with new conditions for the NAMESPACE_ERR
exception on the setAttributeNS method of the Element's interface
(which forbids that the qualified name has a prefix and the
namespaceURI is null or an empty string) there is hope to get DOM1 and
DOM2 namespace methods compatible.  Therefore, I want to come up with
another few suggestions (if those would not convince anybody I must be
quiet for the next month for not to become the reputation of a great
namespace troublemaker :-). So here they are: 

For Attributes set by the non-namespace method the namespaceURI is
supposed to be an empty string or null, and if the Attribute's name is
namespace conform it shall be treated as if it were set by the
namespace method, e.g. setAttribute('a:b') would have the same result
than setAttributeNS('','a:b'), what means that the prefix is 'a' and
localName is 'b'.  If an Attribute is set with no qualified name
setAtttributeNS would raise an exception as usual, but e.g.
setAttribute('a:b:c') is allowed, whose prefix and localName should
then both be an empty string or null.  Changing the prefix shall be
allowed whenever the current nodeName is a qualified name independent
from the type of method that created the attribute; if it is not a
qualified name as in the case of setAttribute('a:b:c'), an exception
shall be raised on trying to modify the prefix.

The different methods of the NamedNodeMap interface shall behave  as
follows (the equivalent methods of other interfaces alike):

getNamedItem
Retrieves a node with the specified name and with a namespaceURI that
is an empty string or null.  If there is a node with the specified
name, but a non-empty namespaceURI it returns null.

getNamedItemNS
If the namespaceURI is an empty string or null, this method ignores
all nodes that have a prefix which is not an empty string or null.  If
the namespaceURI is not empty it operates as usual.

removeNamedItem
Removes node with the specified name and with a namespaceURI that is
an empty string or null.  If there is a node with the specified name,
but a non-empty namespaceURI a NOT_FOUND_ERR is raised.

removeNamedItemNS
If the namespaceURI is an empty string or null, this method ignores
all nodes that have a prefix which is not an empty string or null.  If
it finds no node following this strategy a NOT_FOUND_ERR is raised. 
If the namespaceURI is not empty it operates as usual.

setNamedItem
Adds a node with the specified name and with a namespaceURI that is an
empty string or null.  If such a node is already present in this map,
it is replaced by the new one.

setNamedItemNS
If the namespaceURI is an empty string or null, this method ignores
all nodes that have a prefix which is not an empty string or null.  If
it finds no node following this strategy it adds a node with the
specified localName as nodeName and with a namespaceURI that is an
empty string or null.  If such a node is already present in this map,
it is replaced by the new one.  If the namespaceURI is not empty it
operates as usual.

Neither of the namespace methods shall allow the localName attribute
being null or 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 Wednesday, 8 March 2000 20:37:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT