<br><font size=2 face="sans-serif">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.<br>
<br>
/Phill<br>
IS Dept, Software Engineer.<br>
phill_perryman@mitel.com<br>
http://www.mitel.com<br>
Tel: +44 1291 436023</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>"Daniel Perry" <d.perry@netcase.co.uk></b></font>
<br><font size=1 face="sans-serif">Sent by: jdom-interest-admin@jdom.org</font>
<p><font size=1 face="sans-serif">06/07/2004 14:06</font>
<br>
<td><font size=1 face="Arial"> </font>
<br><font size=1 face="sans-serif"> To: <jdom-interest@jdom.org></font>
<br><font size=1 face="sans-serif"> cc: </font>
<br><font size=1 face="sans-serif"> Subject: [jdom-interest] Listeners</font></table>
<br>
<br>
<br><font size=2 face="Courier New">I've been searching through the mailing lists for info on adding Listeners<br>
to monitor changes in documents, etc.<br>
<br>
So far i've figureed out that these listeners dont exist, and every<br>
proposal/idea that i've come accross in the lists are concerned with events<br>
at the element level.<br>
<br>
I am trying to work out how to do it at the document level.<br>
<br>
I'm using jdom to work with config files and data files. In a current<br>
project i need to save these files when they are changed. I would rather<br>
somthing at a core level does this through a listener rather than call a<br>
method after changing anything.<br>
<br>
ie at the moment i am doing:<br>
<br>
_someElement.setText("newValue");<br>
// somehow get a reference to an xmlHandler class that is responsible for<br>
this document, then...<br>
xmlHandler.save();<br>
<br>
I would rather do:<br>
<br>
_someElement.setText("newValue");<br>
<br>
and have the Document the element belongs to fire off an event through a<br>
listener.<br>
<br>
Does anyone have any suggestions on how i can do this?<br>
<br>
As far as i can see, i would have to extend element and add a reference to<br>
it's document. I would have to also override any methods that change<br>
content to fire off an event through the document. I would have to extend<br>
document to add the listener methods. I would then have extend saxbuilder<br>
and make it use these new types.<br>
<br>
Is there an easier way to do this?<br>
<br>
Thanks,<br>
<br>
Daniel.<br>
<br>
_______________________________________________<br>
To control your jdom-interest membership:<br>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com<br>
</font>
<br>
<br>