- From: James Melton <james.melton@cylogix.com>
- Date: Wed, 27 Jun 2001 18:10:57 -0400
- To: Gavin Stokes <gavin@AmbitiousProductions.com>, "www-dom@w3.org" <www-dom@w3.org>
Consider an element to be a container: it can contain multiple nodes of various types. Although you could conceive of a model where an element is just text, that would not be as useful as the DOM. Separating element and text types is natural for an object model since they have different characteristics. It is also natural in the sense that a program responding to an XML message probably should behave differently toward elements and text. The confusion people seem to have regarding this model also seems to be easily clarified. Just remember that an element contains other nodes. The "value" of an element is not really meaningful, it is the "content" of an element that is meaningful. Gavin Stokes wrote: > > I'm trying to be patient and learn the reasoning behind some DOM design > decisions. To that end, let me ask: Why does setNodeValue on an Element do > nothing? Given that XML is all text, shouldn't every element be able to > contain text as its value? What other kind of value would it contain, > anyway? Why do we have to add a text node? > > There is question after question on various DOM-implementation discussion > forums from people who are baffled by the fact that setNodeValue does > nothing, so I know this is a source of bewilderment for many. > > Regards, > Gavin -- ____________________________________________________________ James Melton CyLogix 609.750.5190 609.750.5100 james.melton@cylogix.com www.cylogix.com
Received on Wednesday, 27 June 2001 18:05:36 UTC