Diffing Multiple Documents

This section describes how to use Stylus Studio to diff multiple XML documents.

Before continuing with this section, you should read Overview, which describes basic information about the Stylus Studio Diff tool, and The XML Diff Viewer, which describes features of the XML Diff Viewer and how to use them.

This section covers the following topics:

Document Focus

Diffing multiple XML documents is much the same as diffing a pair of documents - you specify the source documents (one at a time), a target document, and Stylus Studio calculates the diff.



When you diff multiple source documents against the target, Stylus Studio considers the target document to be the baseline, and the XML Diff Viewer shows how the source documents vary from the target.

When you diff multiple documents, however, only one source document can have focus at a time. Consider the following illustration, which shows three source documents ( source1.xml, source2.xml, and source3.xml) and a target document ( target.xml).

Figure 152. Example of Document Focus

In this example, the source1.xml document currently has focus. You set the focus on a given source document by selecting that document from the drop-down list at the top of the source document window.

When a source document has focus:

  • Diffs are displayed for that document only, even if you have selected the Merged View tab for display.
  • Clicking the remove document button ( ) removes that document from the XML diff calculation.

Symbols Used in the Target Document Window

When diffing multiple documents, Stylus Studio uses an additional set of symbols in the target document window. These symbols, which are displayed in the side bar of the XML Diff Viewer window alongside the standard set of symbols described in Symbols and Background Colors, indicate the ways in which the change identified in the current source document differs from changes to the same node in other source documents.

Figure 153. Example of Symbols Used When Diffing Multiple Documents

As shown in Figure 153, symbols in the column closest to the document tree identify the changes relative to the currently selected source. Here, the edit symbol ( ) indicates that the value in the target document, White, differs from that in the currently selected source (which happens to be Black in this example).

The first column of symbols characterize changes in the currently selected source relative to other source documents. Here, for example, the red exclamation point ( ) indicates that there are conflicting modifications in other source documents - that is, other source documents contain a value other than Black. As shown in Figure 154, when you click on a symbol in the first column, Stylus Studio displays

  • A message describing the precise nature of the change
  • A menu that identifies the documents in which the change occurs.

Figure 154. Easily Navigate to Changed Nodes in Other Source Documents

Clicking on a document in this menu changes the current focus to that source document, allowing you to easily navigate to the same node in a different document.

The additional symbols used by Stylus Studio when diffing multiple documents are described in Table 17.

Yellow circle
Modified in other documents - The object in the target and the current source document are the same, but another source document is different.
Red exclamation point
Conflicting modification in other documents - The object in the current source differs from that in the target document. Other source documents differ from both the current source and target.
Yellow diamond
Same modification in other documents - The source documents all differ from the target document in the same way.
Yellow equal sign
Unchanged in other documents - The current source document differs from the target, but other source documents are the same as the target.
Table 17. Symbols Used to Specify Changes in Source Documents

Consider the example in Figure 155, which illustrates diffing three documents. In this example, the node in question is circled in red.

Figure 155. Diffing Three Documents

Notice that:

  • source1.xml currently has focus.
  • source1.xml and the target document node have the same value ( <abc>)
  • The node in question varies in both of the remaining source documents (it is <abc> in one and <abc> in the other).

Table 18 shows the symbols that might appear based on changing values to the node in question. The example illustrated in Figure 155 is shown in the first row. As values in the source documents change, Stylus Studio changes the diff symbol accordingly.

Table 18. Symbols Used to Specify Changes in Source Documents



Changing the target-source pairing, that is, changing the current source document, affects the symbols that are displayed.

How to Diff Multiple Documents

To diff multiple documents:
1. Select Tools > Options > Show Differences > Files from the Stylus Studio menu.

Stylus Studio displays the XML Diff Viewer.

2. In the source document window, click the add button ( ) to add the first source document.

Stylus Studio displays the Open dialog box.



You can drag and drop a file into the entry field to load the document in the XML Diff Viewer.

3. Navigate to the document you want to load in the XML Diff Viewer.
4. Click Open.
5. Repeat step 2 through step 4 for additional source documents.
6. Repeat step 2 through step 4 for the target document, using the set button for the target document window ( ).

By default, Stylus Studio runs the diff calculation automatically when you select the target document. If the default On changes setting has changed, you need to run the diff calculation manually by clicking the Calculate diff button ( ).

Free Stylus Studio XML Training:
W3C Member