W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2001

RE: suggestion for addition to DOM spec

From: Sander Bos <sander@x-hive.com>
Date: Wed, 18 Jul 2001 11:43:55 +0200
Message-ID: <41D11F414A26E942912B7E7696DC8E220614DA@JAKARTA.xhive.archipel>
To: <www-dom@w3.org>

My answer is a partial testing of the water (seeing if we do the right

> Currently, there's no way to add a DOM_Attribute to an 
> in-memory DOM tree
> that is an ID, even if it should be according to the DTD. Also, when

I think this is implementation dependent. Implementations may internally
record the type of the attribute, so when DTD information is available
they may be aware that an attribute is a DTD attribute (I don't think
there is a DOM-interface to check the type). In that case you do not
have to specify it explicitly, the DOM will do it..

> importing a DOM_Element that has an ID attribute, the 
> attribute is imported
> along with the element, but not recorded as an ID.

Again implementation dependent I think. Also, you must realize with an
import, an attribute may be an ID attribute in one DOM, but not in
another (if the DTDs are different).

> I would like to suggest that either- the DOM_Document should 
> check it's
> DocumentType to see if new or imported Attributes should be 
> used as an ID

We do this. But this does not have to be in the specification I think,
because the specification only says something about ID-attributes in
Document.getElementById. So for the rest, the DOM-implementation should
simply know what attributes are ID-attributes.
(The ID-information is in the latest AS-specification, although I do not
see how to access this info from an Attr easily).

> to add functionality to specifically request that an 
> attribute be treated as
> an ID (e.g. DOM_Document::createIDAttribute()).

This would not work. If I use this DTD

<!ELEMENT myFirstElement ANY>
<!ATTLIST myFirstElement
	att1	ID	#IMPLIED>
<!ELEMENT mySecondElement ANY>
<!ATTLIST mySecondElement

and I would do
you would not know whether it is an ID-attribute or not. This is why we
only determine this information when the attribute is linked to an
element (setters).

Kind regards,


X-Hive Corporation (www.x-hive.com)
email: sander@x-hive.com
phone: +31 10 7108625
Received on Wednesday, 18 July 2001 05:43:57 UTC

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