Re: iterators, etc. + Attribute question

...
>>but does not explicitly state or show inheritance of Node.
>
>Give us a week; there's a face to face DOM WG meeting coming up, and this
>will be resolved.  My best guess is that individual attributes will
>continue to be Nodes, the set of attributes will be a NodeList with
>associative array semantics (or AttributeList).  
>
>
>To answer your question in another message, the whole point of
>AttributeList is to provide associative array semantics so that attributes
>can be looked up by name.  NamedNodeList was once used as the name for
>this, but we found that attributes were the only objects that needed these
>semantics.

Ok, but NamedNodeList is used all over the place in HTML DOM
and Arnaud Le Hors says that AttributeList is archaic (now
basically just a typo).

I have the feeling that there is severe disagreement among y'all
at W3C over DOM collection models. Some sort of simple and clean
way is needed to traverse node trees that can also be *efficiently*
implemented by a DOM vendor. This is clear. I think level one DOM
needs to solve this otherwise users will find other solutions
(ie non-standard extensions a la Microsoft).

The NodeIterator is easy to implement, easy to use, and can be
adapted over or to existing collection models (JGL, STL, etc).
NodeList is less useful because you still need an iteration
mechanism and it does not lend itself to associative collections
because of the indexed access method ( NodeList.item( int n ) ).

I think that any mechanism that limits or overly complicates
implementation will cause a proliferation of non-standard
implementations which will, in the end, just limit the
spread of DOM use. And a DOM that lacks key features
such as a clear node traversal model will end up the same way.

I would suggest three basic interfaces for a collection model:
NodeList, NodeMap, and NodeIterator.

- NodeList more or less what it is now.
- NodeMap would be the associative collection. It should not
have to implement NodeList.item() however - instead the user
should use a NodeIterator.
- NodeIterator would, of course, be a way to traverse *any*
collection of nodes and should be the preferred way to
access DOM nodes. I won't write any IDL here because
its obvious what the interfaces would look like and this
message is already pretty dang long-winded.

And, lastly, the HTML DOM should use the ***same*** model
as the core! What is it with the HTML guys anyway?

BTW, thanks for your replies to my questions!

Regards,
- Claude Zervas

P.S. I don't really understand what Mr. ANOQ of the Sun
is suggesting about AttributeLists...

P.P.S. People are already using the draft spec for implementations
so the need for a speedy resolution can't be over emphasized.

Received on Wednesday, 3 June 1998 03:24:08 UTC