[jdom-interest] Listeners

Phill_Perryman at Mitel.COM Phill_Perryman at Mitel.COM
Tue Jul 6 07:16:34 PDT 2004

If the files are not huge you can use outputter to write the newly built 
Document to a string. The save method then re-outputs the string and 
compares the two. If they are the same don't save it.

IS Dept, Software Engineer.
phill_perryman at mitel.com
Tel: +44 1291 436023

"Daniel Perry" <d.perry at netcase.co.uk>
Sent by: jdom-interest-admin at jdom.org
06/07/2004 14:06

        To:     <jdom-interest at jdom.org>
        Subject:        [jdom-interest] Listeners

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 
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?



To control your jdom-interest membership:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20040706/bf46a73a/attachment.htm

More information about the jdom-interest mailing list