private static synchronized void saveXML(Element rootElement,File containerFile) throws IOException {
  try {
    String filePath=containerFile.getCanonicalPath();
    String filePathWithoutExtention=filePath.substring(0,filePath.lastIndexOf('.'));
    File oldFile=new File(filePathWithoutExtention + ".old");
    if (oldFile.exists())     oldFile.delete();
 else     containerFile.renameTo(oldFile);
    PrintStream attrStream=new PrintStream(new FileOutputStream(filePath));
    JSpaceUtilities.domWriter(rootElement,attrStream,"");
    attrStream.close();
  }
 catch (  FileNotFoundException ex) {
    if (_logger.isLoggable(Level.SEVERE)) {
      _logger.log(Level.SEVERE,"FileNotFoundException: " + ex.toString(),ex);
    }
  }
}

private static synchronized void saveXML ( Element rootElement , File containerFile ) throws IOException { try { String filePath = containerFile . getCanonicalPath ( ) ; String filePathWithoutExtention = filePath . substring ( 0 , filePath . lastIndexOf ( '.' ) ) ; File oldFile = new File ( filePathWithoutExtention + ".old" ) ; if ( oldFile . exists ( ) ) oldFile . delete ( ) ; else containerFile . renameTo ( oldFile ) ; PrintStream attrStream = new PrintStream ( new FileOutputStream ( filePath ) ) ; JSpaceUtilities . domWriter ( rootElement , attrStream , "" ) ; attrStream . close ( ) ; } catch ( FileNotFoundException ex ) { if ( _logger . isLoggable ( Level . SEVERE ) ) { _logger . log ( Level . SEVERE , "FileNotFoundException: " + ex . toString ( ) , ex ) ; } } }
every change in container the container xml file will be updating be this method . on every update current file will be renamed to < % filename % > . old and the new one will be < % filename % > . xml
