W3C home > Mailing lists > Public > www-dom@w3.org > January to March 1999

Attr confusion

From: <uche.ogbuji@fourthought.com>
Date: Wed, 13 Jan 1999 20:47:09 -0700
Message-Id: <199901140347.UAA03818@malatesta.local>
To: www-dom@w3.org
I asked a few questions last week about automatically completing DOM trees for 
the user, but got no response.  Perhaps I wasn't clear, and I'll try again, 
but first here is a different question.

The specification for the Attr interface appears to require knowledge of the 
DTD, which, as I understand it, is contrary to the spirit of the DOM Level 1.

"The attribute's effective value is determined as follows: if this attribute 
has been explicitly assigned any value, that value is the attribute's 
effective value; otherwise, if there is a declaration for this attribute, and 
that declaration includes a default value, then that default value is the 
attribute's effective value; otherwise, the attribute does not exist on this 
element in the structure model until it has been explicitly added. Note that 
the nodeValue attribute on the Attr instance can also be used to retrieve the 
string version of the attribute's value(s)."

Note the part about "if there is a declatration for this attribute..."  I 
assume <!ATTLIST...> is meant, with all of its provision for #IMPLIED values, 
etc.  How does the DOM implementation know of this information?

Aside: "string version of the attribute's value(s)".  As opposed to what other 
version?  an entity reference?  The target of an XLink?

And re: the "specified" attribute of Attr:

"If this attribute was explicitly given a value in the original document, this 
is true; otherwise, it is false.  Note that the implementation is in charge of 
this attribute, not the user. If the user changes the value of the attribute 
(even if it ends up having the same value as the default value) then the 
specified flag is automatically flipped to true. To re-specify the attribute 
as the default value from the DTD, the user must delete the attribute. The 
implementation will then make a new attribute available with specified set to 
false and the default value (if one exists)"

First of all, how does the Attr implementation know anything about default 
values and whether it was specified?  Document::createAttribute(name), which 
is the only current creation interface, does not allow setting whether the 
attribute was specified, or (assuming the creator has access to the DTD), any 
default values.

I see the connection to Element::removeAttributeNode, but this also appears to 
rely on DTD info:

"If the removed Attr has a default value it is immediately replaced"

Uche Ogbuji
FourThought LLC, IT Consultants
uche.ogbuji@fourthought.com	(970)481-0805
Software engineering, project management, Intranets and Extranets
http://FourThought.com		http://OpenTechnology.org
Received on Wednesday, 13 January 1999 22:45:26 UTC

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