Skip to content

Instantly share code, notes, and snippets.

@gioele
Last active August 29, 2015 14:20
Show Gist options
  • Save gioele/a27355041c6f46a5ea17 to your computer and use it in GitHub Desktop.
Save gioele/a27355041c6f46a5ea17 to your computer and use it in GitHub Desktop.

Revisions

  1. gioele revised this gist Apr 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mom-diff-steps.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ Call

    fc.xml.diff.Diff.diff(InputStream ver0, InputStream ver1, OutputStream diff_result)

    Now the differences (in textual form) are in `diff_doc`.
    Now the differences (in textual form) are in `diff_result`.

    ### Elaboration of the results

  2. gioele revised this gist Apr 28, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions mom-diff-steps.md
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,8 @@ First approximation

    ### Preparatory steps

    1. serialize the base document (version 0) in the variable `ver0_string`;
    1. serialize the modified document (version 1) in the variable `ver1_string`;
    1. serialize the base document (version 0) in the variable `String ver0_string`;
    1. serialize the modified document (version 1) in the variable `String ver1_string`;
    1. create a `ByteArrayOutputStream diff_result` object.

    ### The call
  3. gioele renamed this gist Apr 28, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. gioele renamed this gist Apr 28, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. gioele created this gist Apr 28, 2015.
    27 changes: 27 additions & 0 deletions Steps
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    First approximation
    -------------------

    ### Preparatory steps

    1. serialize the base document (version 0) in the variable `ver0_string`;
    1. serialize the modified document (version 1) in the variable `ver1_string`;
    1. create a `ByteArrayOutputStream diff_result` object.

    ### The call

    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_doc`.

    ### Elaboration of the results

    Get a string for the result calling

    String diff_result_string = diff_result.toString(StandardCharsets.UTF_8)

    Output `diff_result_string`.