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

Re: Why is the value of an Attribute a Node?

From: Mike Champion <mcc@arbortext.com>
Date: Fri, 15 May 1998 16:11:03 -0400
Message-Id: <98May15.161115edt.26881@thicket.arbortext.com>
To: www-dom@w3.org
At 03:55 PM 5/15/98 -0400, Hank Davidson wrote:
>The java interface for Document specifies that the arguments to the
>createAttribute method are the name (a String) and a value (a Node).
>Why is value a Node?  It seems inconsistent with the getValue method on
>Attribute which returns a String, and the setAttribute method on Node
>which takes a String for the value.

I think there's some errors in the current draft of the spec (the Attribute
stuff was discussed at the last minute before the draft went out), and
things DEFINITELY should be explained more clearly.

Conceptually, Attribute values are Nodes because in XML, entity references
in can expand to make the value an arbitrarily complex tree, and the Node
is the root of that tree.  In HTML, and in probably the vast majority of
XML applications, the value is a string.  SO, we formally define it as a
Node, but give convenience methods to get/set attribute values as strings
since that will be the most common usage.

I'll clarify all this in the next draft.

Mike Champion
Received on Friday, 15 May 1998 16:14:10 UTC

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