API Sample

 Table of Contents

1. Summary

This sample illustrates how the API (Application Programming Interface) can be used to run the DITA Comparison.

Depending on which product you have downloaded the sample directories will contain content for either the Java or .NET platforms (e.g. Java or C# source code). This documentation will discuss both APIs.

In both platforms there are four main API classes for accessing the comparison (.NET classes hava an additional 'DotNet' suffix):

DitaTopicCompareFor accessing the DITA topic comparison.
DitaMapfileCompareFor accessing the DITA map file comparison.
DitaMapTopicsetCompareFor accessing the DITA map based topic-set comparison.
DitaCompareFor accessing the map-file, map-topicset and topic comparisons, through a simplified interface.

1.1. Command-line Arguments

The samples for each platform support the use of a command-line argument from the entry-point class to control which DITA Compare API classes are used. The arguments used are included in the sample summary tables.

2. Java API

There are 5 Java classes in the Java API sample:

Sample ClassCorresponding API ClassCommand-line argument
MapTopicsetCompare.javaDitaMapTopicsetCompare (1)mts
MapTopicsetCompareInPlace.javaDitaMapTopicsetCompare (2)mts-inplace
Main.java(none - the main JAR class)(not-applicable)


This sample is a .NET console application, DitaFileCompareApi.

There are four C# classes:

Sample ClassCorresponding API ClassCommand-line argument
MapTopicsetCompare.csDitaMapTopicsetCompareDotNetmts | mts-inplace
Program.cs(none - the startup class)(not-applicable)

4. Running the sample

The sample resources and a description on how to run it can be found at: https://bitbucket.org/deltaxml/api-sample for Java and here for .NET.

The resources should be checked-out, cloned or downloaded and unzipped into the samples directory of the DITA Compare release. They should be located such that they are two levels below the top level release directory, for example DeltaXML-DITA-Compare-8_0_0_j/samples/api-sample.

#content .code