[jdom-interest] JDOM && Jaxen

James Strachan james_strachan at yahoo.co.uk
Fri Aug 3 04:13:25 PDT 2001


From: "Szegedi Attila" <szegedia at freemail.hu>
> I have a suggestion: Namespace class could have flyweight and "localized"
> instances (those that are being tied to particular Element, hence have a
> concrete location). We could introduce an "Element parent" field and
> associated accessors to it. The flyweight instances would have null
parent.
> The Element could have getLocalizedNamespace() and
> getLocalizedNamespace(String) in addition to getNamespace() and
> getNamespace(String) that would return a NEW localized namespace on each
> call constructed to be identical to the flyweight, only with parent set to
> "this" element. This way it wouldn't create burden on memory and CPU in
> typical JDOM usage, but if someone uses XPath with namespace expressions
> they'll be available in form of short-lived temporary objects.

FWIW this is how dom4j works, flyweight nodes such as Namespaces or
Attrbutes can be 'localized' to a particular parent Element.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




More information about the jdom-interest mailing list