laurent.bihanic at atosorigin.com
Wed Jan 30 08:50:21 PST 2002
To support this feature, JDOM needs to know that a given attribute is an ID.
The latest JDOM (in CVS) supports attribute types. So if you have a DTD, you
can declare some attributes to be IDs and JDOM will save this information.
Now accessing an element by its ID is just a matter of building a look-up
table when parsing the document. This feature is not included in the default
JDOM Document and Element objects because it would consume extra CPU and
memory every time a document is parsed or a new Element is added to a Document.
So, the best way to support this feature is to subclass Document and Element
and create a new JDOMFactory implementation to return these subclasses. That
way, only people actually needing the look-up feature will pay the price (CPU
+ memory) for it.
A example of such a factory will shortly be available in the contrib package.
If you are interested in this sample code, just drop me a mail and I'll send
you the code.
Eugene Karpov wrote:
> It is very useful method in DOM Document: Document.getElementById. Why you
> did not implement it?
More information about the jdom-interest