[jdom-interest] Re: carrying user data around with an Element

David Churchville dmc at clearlight.com
Wed Nov 15 12:38:07 PST 2000


I'd like to be able to set a "user object" on an Element (in lieu of
subclassing, using factories, special builders, etc. - see Factories for
element creation discussion).

It would basically add the following to the Element class:

public void setUserObject( Object o);
public Object getUserObject();

Purpose: allow custom application data (not related to parsing XML) to
travel around with Element objects.

Examples:
- An XML tool could read data with JDOM, allow modifications visually (which
modify the JDOM tree), and store arbitrary UI data in the Element, such as a
color or icon to use when rendering it.

- An XML processor could use the JDOM tree, and mark which elements had been
visited already by storing a "visited" user object (a Boolean flag, for
example)

Comments?




More information about the jdom-interest mailing list