- serialize the base document (version 0) in the variable
String ver0_string
; - serialize the modified document (version 1) in the variable
String ver1_string
; - create a
ByteArrayOutputStream diff_result
object.
Call
InputStream ver0 = new ByteArrayInputStream(ver0_string.getBytes(StandardCharsets.UTF_8));
InputStream ver1 = new ByteArrayInputStream(ver1_string.getBytes(StandardCharsets.UTF_8));
fc.xml.diff.Diff.diff(InputStream ver0, InputStream ver1, OutputStream diff_result)
Now the differences (in textual form) are in diff_result
.
Get a string for the result calling
String diff_result_string = diff_result.toString(StandardCharsets.UTF_8)
Output diff_result_string
.