void (String oldPath, String newPath, final String outPath) { try { Element oldDoc = oldPath == null ? null : JDOMUtil.load(Path.of(oldPath)); Element newDoc = JDOMUtil.load(Path.of(newPath)); OutputStream outStream = System.out; if (outPath != null) { outStream = new BufferedOutputStream(new FileOutputStream(outPath + File.separator + new File(newPath).getName())); } Document delta = createDelta(oldDoc, newDoc); JDOMUtil.writeDocument(delta, outStream, "\n"); if (outStream != System.out) { outStream.close(); } } catch (Exception e) { e.printStackTrace(); } }