W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2001

setting an element's value?

From: Gavin Stokes <gavin@AmbitiousProductions.com>
Date: Mon, 09 Jul 2001 16:10:15 -0700
Message-Id: <>
To: rayw@netscape.com (Ray Whitmer)
Cc: W3C DOM mailing list <www-dom@w3.org>
I think people ask about setting an element's value because it doesn't 
really conflict with the concept of having subnodes.  There's no reason 
that an element can't have a text "value" and then contain subnodes as 
well.  In an outline, each heading has a "value" (its text), but can have 
numerous subheadings with their own values.  Since XML is, in fact, all 
text like an outline, this makes sense.

It seems that the only reason you can't just have the "value" text in 
between the element tags (before or after all the subnodes) is the 
perceived necessity to have multiple independent blocks of text 
interspersed with the subnodes.  But why should that be allowed anyway?  If 
you want a bunch of independent text nodes under an element, then yes, they 
should have to be added as subnodes.   An element should have only one 
value.  Wouldn't this work?

   <?xml version="1.0" encoding="ISO-8859-1" ?>
	This is the command element's value. Now let's have some subnodes.
		<COMMAND_NAME>get metadata template</COMMAND_NAME>
			<NAME />
		<NAME />
Received on Monday, 9 July 2001 19:09:41 UTC

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