szegedia at freemail.hu
Thu Nov 14 04:13:47 PST 2002
I believe I know why lookup by ID wasn't addressed before... As it turns
out, ID information is something global (at least on the Document level),
and some tradeoffs come into play. I.e. indexing ID information in a Map in
the document makes structural tree manipulations more time consuming, as
detached/attached element subtrees have to be walked to collect IDs to
add/remove from the Map.
This can be remedied if we explicitly mark a document as maintaining indexed
IDs or not (i.e. Document.setUseIdIndexing(boolean)). This way, ID indexing
can be turned off for heavy tree manipulations and turned back on for
document querying. This seems to be the most flexible solution. With ID
indexing turned off tree manipulations will be fast, and lookup by ID will
be slow, while with ID indexing turned on it would be the other way round.
----- Original Message -----
From: "Attila Szegedi" <szegedia at freemail.hu>
To: <jdom-interest at jdom.org>
Sent: 2002. november 14. 10:17
Subject: [jdom-interest] getElementById()
> I'd be pretty happy if JDOM.Document had a getElementById method, much
> DOM and EXML (starting from 6.0) have it.
> I'm willing to volunteer and implement it. All it takes is a Map in the
> Document to keep the ID mappings as well as the proper bookkeeping of it
> Element methods setParent, setDocument, detach, and setAttribute. No big
> deal, really. Finally Jaxen could support the id() function on JDOM
> documents as well (this is my primary motivation, actually).
> The only question is whether the JDOM coordinators (Jason and Brett) can
> imagine this functionality be present in JDOM?
> Attila Szegedi
> home: http://www.szegedi.org
> To control your jdom-interest membership:
More information about the jdom-interest