Implementing NodeList

I'm just starting to work on a Java implementation of the DOM, and just
subscribed to this discussion, so please accept my apologies if this is a
previously-answered question.

NodeList is a very powerful concept -- but if I'm reading the Draft
correctly, it's so powerful that none of the obvious implementations seem
to be adequate. It has two characteristics that I haven't yet figured out
how to offer simultaneously without rather painful amounts of overhead:

a) It's "live". As I read it, that means that not only are the listed nodes
individually live (which is trivial), but that the NodeList itself is
updated when nodes that it would have found are created and destroyed.

b) It's an ordered list. I'm reading that to imply the same order that the
nodes are found in the document -- or, viewed from another angle: if I
request a NodeList, add a node, and request another NodeList, all nodes in
both lists have to have the same indices. (If not, life becomes MUCH
simpler by eliminating the need to determine the proper insertion point
within the NodeList.)

Does anyone have a good efficient architecture for this (and if so, would
you be willing to share any hints)? Or does the fact that the document
explicitly doesn't "define or constrain" imply that the spec's authors are
having as much trouble finding an elegant solution as I am?

Many thanks in advance! I have the distinct feeling that when I see the
reply, I'm going to pound my head on the table ... but I hope it'll be
because I missed something obvious.

-- Joe Kesselman

Received on Sunday, 26 July 1998 20:20:38 UTC