[jdom-interest] Listeners

Daniel Perry d.perry at netcase.co.uk
Tue Jul 6 06:06:11 PDT 2004

I've been searching through the mailing lists for info on adding Listeners
to monitor changes in documents, etc.

So far i've figureed out that these listeners dont exist, and every
proposal/idea that i've come accross in the lists are concerned with events
at the element level.

I am trying to work out how to do it at the document level.

I'm using jdom to work with config files and data files. In a current
project i need to save these files when they are changed.  I would rather
somthing at a core level does this through a listener rather than call a
method after changing anything.

ie at the moment i am doing:

// somehow get a reference to an xmlHandler class that is responsible for
this document, then...

I would rather do:


and have the Document the element belongs to fire off an event through a

Does anyone have any suggestions on how i can do this?

As far as i can see, i would have to extend element and add a reference to
it's document.  I would have to also override any methods that change
content to fire off an event through the document.  I would have to extend
document to add the listener methods.  I would then have extend saxbuilder
and make it use these new types.

Is there an easier way to do this?



More information about the jdom-interest mailing list