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: <5.0.0.25.2.20010709154906.00aa9100@pop.enteract.com>
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" ?>
- <COMMAND_TRANSMISSION>
	<COMMAND>
	This is the command element's value. Now let's have some subnodes.
		<COMMAND_NAME>get metadata template</COMMAND_NAME>
		<COMMAND_GUID>906FA492-0000-00E7-61A4-691C00000009</COMMAND_GUID>
		<USER>
			<GUID>906FA492-0000-00E7-61A4-691C0000000D</GUID>
			<NAME />
			<PASSWORD />
		</USER>
	<EXCEPTION>
		<MESSAGE />
		<REASON_CODE>0</REASON_CODE>
		<REFERENCE_GUID>906FA492-0000-00E7-61A4-6A0700000010</REFERENCE_GUID>
	</EXCEPTION>
	<METADATA_TEMPLATE>
		<GUID>906FA492-0000-00E7-61A4-691C0000000F</GUID>
		<NAME />
	</METADATA_TEMPLATE>
	</COMMAND>
   </COMMAND_TRANSMISSION>
Received on Monday, 9 July 2001 19:09:41 GMT

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