W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2001

Re: DOM - odd absent interface method?

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Mon, 21 May 2001 08:55:09 -0400
To: W3C DOM mailing list <www-dom@w3.org>
Message-ID: <OF5535F91F.6BC04464-ON85256A53.00467A9C@pok.ibm.com>

>How come there's no "setNodeName" method?

The nodeName (together with the namespace URI) indicates the semantic role
this node is playing in the document, and different names even of the same
node type may reflect different subclassing of the node. Look at the HTML
DOM for plenty of examples; some Element nodes carry methods that others
may not. Other DOMs may implement similar role-specific extensions. Since
you can't change an object's class once it has been created (in most
languages), we really can't promise that you can change the semantic role
after the object has been created -- and hence both nodeName and
namespaceURI are immutable.

>If you're passing a node to a subroutine to have it filled

If you need to set the node's name/type: Don't. Instead, pass the Document
node into the subroutine, and have the subroutine use the Document's
factory methods create and return a new Node object of the appropriate type
and with the appropriate name.

Joe Kesselman  / IBM Research
Received on Monday, 21 May 2001 08:55:55 UTC

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