Re: DOM - odd absent interface method?

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 UTC