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

Re: DOM - odd absent interface method?

From: Jeff Yates <PBWiz@mail.pbwizard.com>
Date: Fri, 18 May 2001 22:11:43 -0400
Message-Id: <200105182211.AA178258122@mail.pbwizard.com>
To: W3C DOM mailing list <www-dom@w3.org>, Gavin Stokes <gavin@AmbitiousProductions.com>
Gavin,

In the DOM, a node is NOT just a node.  There is no such object as a node by itself.  The node is just an interface that almost all objects in the DOM inherit from.

What this means is that you never construct a node object, you construct an object (say a text node).  When you construct this object you have already assigned it it's name by the constructor you call.

Examples:
document.createElement("div");  
           // a node with the name of "div"
document.createTextNode("this is my text");  
           // a node with the name of "#text";
document.implementation.createDocument("","",null);
           // a node with the name of "#document"

once a node (in it's generic since) is created, you cannot change it's name because the name is a referenece to the type of node that it is, and what interfaces it exposes.  

Jeff.





---------- Original Message ----------------------------------
From: Gavin Stokes <gavin@AmbitiousProductions.com>
Date: Fri, 18 May 2001 18:59:32 -0700

Hi all.

I just started using the DOM, and I have a simple question:  How come 
there's no "setNodeName" method?  If you're passing a node to a subroutine 
to have it filled (for example, you're converting C++ objects into XML 
nodes), that routine has no way to set the name except some roundabout 
construction of a temporary node and then a use of the = operator.

Regards,
Gavin Stokes



--
Jeff Yates
e-mail:    PBWiz@PBWizard.com
Homepage:  http://www.PBWizard.com

--
Received on Friday, 18 May 2001 22:13:11 GMT

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