The
Merge Files with Change Tracking Highlights
script (
mergeFilesTrackChanges.sh, found in the
scripts
subfolder inside
Oxygen's installation directory) can be used to merge 2 XML files
(based on a 2-way comparison). The
Author mode comparison results are
saved as documents with highlighted tracked changes that can later be reviewed and accepted or
rejected.
Notice: This script is intended to be used for
merging XML documents (Oxygen XML Author Eclipse plugin creates change tracking markers only for XML
file types. Using this script for document types other than XML, or for documents that are
not XML well-formed, causes document parsing errors and the merge operation
fails.
Arguments for the Merge Files with Change Tracking Highlights Script
sh mergeFilesTrackChanges.sh pathOfBaseFile pathOfFileToMergeWith [[pathOfOutFile] [-nb noBackupOfBaseFile]] [-help | --help | -h | --h]
- pathOfBaseFile
- Mandatory argument that specifies the path of the base file (it can also be provided
as a URL).
- pathOfFileToMergeWith
- Mandatory argument that specifies the file to merge with (it can also be provided as
a URL).
- pathOfOutFile
- Optional argument that specifies the path of the file where the merge operation
results are saved to (it can also be provided as a URL). If present, it must appear
immediately after the first two mandatory arguments. If absent, the merge results are
saved to the base file, by overwriting it. You cannot choose the same file specified
as the file to merge with as the output file (the merge process is aborted in this
case). Also, if the output is a remote resource, its entire parent directory structure
must already exist. Otherwise, an I/O exception is thrown and the merge results cannot
be saved.
- -nb noBackupOfBaseFile
-
Set to true if you do not want a backup copy of the base
file on the hard disk. There are 2 situations when a backup of the base file is
performed automatically and the backup operation must succeed to proceed with the
merge. Otherwise, the merge process is aborted if the output file is not specified
(i.e. the pathOfOutFile argument is not present) or the specified
output file is the base file itself.
The backup copy will have the same parent directory as the base
directory and its name will be the name of the base file suffixed by ".OXY.BAK". The
default value is
false, which means that for either of the 2 previously
mentioned situations, a backup copy of the base file will be kept on the hard
disk.
Note: The backup copy can be deleted only if the base
file and, implicitly, its backup copy are local resources (not remote).
- -help | --help | -h | --h
- Displays help text.
Note: For boolean arguments, it is not necessary to provide
the "true" value. Their presence in the argument list is equivalent to setting their value
to "true" (and their absence from the argument list is equivalent to setting their value to
"false"). However, constructs of the form bool_option true|false are
accepted and interpreted accordingly
Examples of Compare Files Script
- Example 1: Compare Files and View Results in XML Format
-
The following command results in merging
file1
and
file2 into
outfile with changes
highlighted:
sh scripts/mergeFilesTrackChanges.sh file1 file2 outfile
- Example 2: Compare Files with Line by Line Algorithm
-
The following command results in merging
file1
and
file2 by overwriting
file1. However, the
file1 is backed up
first:
sh scripts/mergeFilesTrackChanges.sh file1 file2
- Example 3: Compare Files and Generate Comparison Report
-
The following command results in merging
file1
and
file2 by overwriting
file1. Although
file1 is initially backed up, the backup is eventually
removed:
sh scripts/mergeFilesTrackChanges.sh file1 file2 -nb