To follow this tutorial you will need the two sample XML files listed on the right. You can download each of these files through the following links: Books1.xml and Books2.xml. Save both of these files to your computer and launch Project: Merge through the shortcut on the Windows Start Menu.
When launched directly from the Start Menu, Project: Merge will display the Open Dialog and prompt you to select the XML files you wish to open and what kind of operation you wish to perform on them.
Operation Type
For the purposes of this tutorial you should select the XML File Merge option.
Base File
Because this tutorial is merging two XML files, you should ensure the Use a Common Base File option is unchecked.
Left and Right Files
Click on the ... buttons next to the Left File and Right File edit boxes to browse and select the XML files you downloaded earlier.
It should be noted that you cannot compare or merge any XML files without a format specification. Click Yes to begin creating a new format specification for these XML files. You will be shown the Create Format Specification Dialog:
Specification Name
Give the format specification the name Books. Specification names are for your reference only, so we recommend
you are as clear as possible when naming your file specifications.
Filename Wildcards
Project: Merge matches format specifications to XML files through the name of the root element in the file. If several format
specifications match the root element, Project: Merge will use the filename wildcards specified here to determine which format specification is to
be used. For the purposes of this tutorial, we will leave this empty. You can always change these settings later through the Preferences Dialog.
Fortunately, we're not finished yet.
If you take a moment to look at the overview pane down the left side of the Project: Merge window you can see very clearly where Project: Merge has decided to select parts from the left file (Books1.xml - marked in blue) and the right file (Books2.xml - marked in green). You can also see where the conflicted portions are (marked in red) and where the two files are identical (the blank areas between the differences). You can quickly navigate to anywhere in the results by simply clicking in the overview pane. When you have finished looking at the current merge results, scroll back to the top of the window.
We will now attempt to improve the results of this merge. As mentioned above, the XML files used for this tutorial contain lists of books where each book has a unique identifier - the id attribute. We can instruct Project: Merge to use these id attributes to identify each book in the file. By doing this we will be able to drastically improve the results of the merge.
Right click over the book element or any of its attributes and select 'book' Properties.... You will be presented with the preferences dialog with the panel for the book element selected as shown below: The Element Properties panel allows you to control how Project: Merge identifies elements. Project: Merge can use the attributes of an element, child elements, or character data to identify different elements within an XML file. When you create a new format specification, by default, Project: Merge do not attempt to uniquely identify any elements beyond comparing matching element tags.
For this example, we want to use id attributes to uniquely identify book elements:
Order of Children
First off, we inform Project: Merge that the order of child elements for books is unimportant. Whether
the title of a book appears before the author's name in the file or not doesn't change the meaning of the data.
Identified by
We want books to be identified by Attribute(s), so select that option. A list of known attributes for
books will appear below. There is only one entry, id, and it should be selected.
All that remains to be done now is to save the results of the merge. This is achieved either by selecting Save from the File menu, or by clicking the save button on the toolbar. (Project: Merge will also prompt you to save the merged results if you haven't already done so when exiting.)