Altova XMLSpy 2025 Professional Edition

Compare Open File With

Home Prev Top Next

This command allows you to compare the open file with another file. The comparison shows the files to compare tiled vertically in the main window with the differences between them highlighted in each file. If a difference is between two files, then the difference is highlighted in green. If content is different across three files (available in the Enterprise Edition only), then this is referred to as a conflict, and the conflict is highlighted in pink. You can compare files as XML documents (where the structure and semantics of tags is significant) or as text documents.

 

Note:Three-way file comparisons are available in the Enterprise Edition only.

 

To compare the active file (in the GUI) with another file, do the following:

 

1.With the file to compare active in the Main Window (only one open file can be active at a given time), click Tools | Compare open file with. A Browse dialog appears (screenshot below), in which you can browse for one or two files to compare with the active file.

Click to expand/collapse

2.Click Browse to select a file via file explorer, a global resource, or a URL. Click Window to select a file that is open in one of the windows of XMLSpy.

3.Click OK. The Settings dialog appears (screenshot below). These settings are described in the topic Compare Options. If you wish to not have this dialog appear each time you start a compare session, uncheck Show settings before starting compare (located at the bottom of the dialog).

diff_settings_dialog

4.Select the required settings, then click OK. Two things happen: (i) The files to compare are displayed side-by-side in separate panes; (ii) The Compare Files control window appears. (Screenshots in next section, File Comparisons.)

5.You can navigate and merge differences by using the buttons in the Compare Files control window. (For usage information, see the next section, File Comparisons.)

6.When you finish reviewing and/or merging differences, click Done.

 

Note:Compare settings can be changed during a Compare session (by selecting Tools | Compare options), but will only take effect from the next Compare session onward; the new settings will not affect the current session.

 

File comparisons and merging of differences

There are two types of comparison:

 

Two-way comparison: Two files are compared. The file that was active (when comparison was requested; called active file for short) is displayed in the left-hand pane and is compared against a second file (see screenshot below).

diff_files_view

Three-way comparison (Enterprise Edition only): Three files are compared. The active file is displayed in the left-hand pane. The first of the two files that were selected for comparison against the active file is displayed in the middle pane. This middle file is known as the base file. You can merge a difference between the left-hand file and the base file, or a difference between the right-hand file and the base file.

 

Note:You should not move panes in the window; otherwise, the Copy To directions of the buttons in the Compare Files control window might not be correct any longer.

 

 

Differences and conflicts

Differences and conflicts are highlighted in different colors (see Highlight colors below) and can be navigated separately.

 

Differences: When content at corresponding locations in two files is different. Highlighted in green.

Conflicts: When content at corresponding locations in three files is different. Highlighted in pink.

 

Note:Two-way comparisons show only differences, no conflicts.

 

 

Navigating differences and conflicts

You can navigate through the document by using the buttons in the Select Difference pane of the Compare Files control window (shown below: two-way comparison, followed by three-way comparison). The pane contains four buttons for two-way comparison, and six buttons for three-way comparison (see screenshots).

Click to expand/collapse

The Compare Files control window contains the following buttons:

 

First: Goes to the first of all the differences and conflicts in the document.

Last: Goes to the last of all the differences and conflicts in the document.

Previous: Goes to the previous difference from the currently active difference or conflict.

Next: Goes to the next difference from the currently active difference or conflict.

Previous Conflict: Goes to the previous conflict from the currently active difference or conflict.

Next Conflict: Goes to the next conflict from the currently active difference or conflict.

 

 

Merging differences and conflicts

You can use the buttons in the Merge pane to copy the highlighted content from one pane to another. Use the appropriate Copy-direction button of a pane-pair. In order to enable merging, the following Compare options must be set:

 

Detailed differencing must be checked, and

Ignore node depth must be unchecked.

 

When you finish reviewing and/or merging differences, click Done.

 

Note:If you wish to undo a merge, stop the Compare session, select the file in which the change is to be undone, and select Edit | Undo or press Ctrl+Z.

 

Note:While the Compare session is active, no editing or change of views is allowed. Any attempt to edit or change the view of either file will pop up a message warning that the Compare session will be ended.

 

Highlight colors

If corresponding lines are different in two files, then they are highlighted in green in both files (differences). If lines are different in three files, then they are highlighted in pink in all three files. If a difference is selected, it is indicated in both files in a darker green color. If a conflict is selected, it is indicated in both files in a darker pink color.

 

The highlight colors used in Compare sessions are given in the table below.

 

diff_difference

Difference

diff_currentdiff

Current difference

diff_mergeddiff

Merged difference

diff_currentmergeddiff

Current merged difference

diff_conflict

Conflict

diff_currentconflict

Current conflict

 

 

© 2018-2024 Altova GmbH