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 Friday, 15 May 1998 16:14:10 UTC