[jdom-interest] Element Reference from Attribute

Jason Hunter jhunter at collab.net
Wed Nov 22 21:12:55 PST 2000

> It also means that instances of
> Attribute and other leaf nodes cannot be shared throughout a 
> tree which can have a big effect on performance and 
> memory consumption. 

They can't be shared as is, because a setValue() on one would wrongly
affect the other.

I like the idea of adding a getParent() method to the major components
because that also solves the problem of duplicate adds.  

That's where you add an attribute to another element but do not remove
the original.  This causes problems when the new or old attribute
changes -- because they're the same attribute.  This bit Andy while he
was creating JATO, and he talked my ear off about it.  A getParent()
would allow attribs to work like elements and be added to a tree only
one time.  (A read-only tree could skip the parentage check.)


More information about the jdom-interest mailing list