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

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

From: Hank Davidson <hankd@corel.com>
Date: Mon, 18 May 1998 10:05:36 -0600
Message-ID: <000901bd8276$cb435020$842a640a@hankd_dual.corelus.com>
To: "Mike Champion" <mcc@arbortext.com>, <www-dom@w3.org>
A couple more questions, please.

1. What happens to the node that is passed in to the Attribute factory; does
it become the child of the attribute?
2. If so, how do you construct the attribute when it may have multiple
children, e.g. text - entity reference - text?
3. If not, what type of node is it that is passed in?  Do its children
become the children of the resulting attribute node?
Does this mean that to set a simple text value, it would be represented by a
two-deep hierarchy as the parameter to the constructor?

-----Original Message-----
From: Mike Champion <mcc@arbortext.com>
To: www-dom@w3.org <www-dom@w3.org>
Date: Friday, May 15, 1998 2:27 PM
Subject: Re: Why is the value of an Attribute a Node?


>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 Monday, 18 May 1998 12:05:38 GMT

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