Skip to main content
Skip table of contents

Java API Sample

Introduction

This sample is a basic demonstration of how to use XML Merge's Java API to run some simple merge operations with hard-coded file paths.

Implementation

The sample is implemented in the main method of a single Java class, SimpleRunner.java, and the approach taken is as follows:

  1. Create File objects forsample inputs.

  2. Instantiate the merge object using either ConcurrentMerge or SequentialMerge;

  3. Set the ancestor file (Only for ConcurrentMerge) with: ConcurrentMerge.setAncestor;

  4. Add the demo input versions by using one of the following:

    1. ConcurrentMerge.addVersion

    2. SequentialMerge.addVersion

  5. Call one of the following methods to produce a DeltaV2 representation of the merge.

    1. ConcurrentMerge.extractAll

    2. SequentialMerge.extractAll

Additionally, the ThreeWayMerge class can be used with one of its merge methods to allow merge operations to be performed with a single method call. This class also allows the approach shown above but we only demonstrate the simpler method calls in the sample code.

Running

To run this sample, all the files you need together with instructions are available on Bitbucket


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.