API Sample

 Table of Contents


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.

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.


Java API

There are 5 Java classes in the Java API sample:

Sample ClassCorresponding API ClassCommand-line argument
TopicCompare.javaDitaTopicComparetopic
MapfileCompare.javaDitaMapfileComparemapfile
MapTopicsetCompare.javaDitaMapTopicsetCompare (1)mts
MapTopicsetCompareInPlace.javaDitaMapTopicsetCompare (2)mts-inplace
GeneralCompare.javaDitaCompare(empty)
Main.java(none - the main JAR class)(not-applicable)


.NET API

This sample is a .NET console application, DitaFileCompareApi.

There are four C# classes:

Sample ClassCorresponding API ClassCommand-line argument
TopicCompare.csDitaTopicCompareDotNettopic
MapfileCompare.csDitaMapfileCompareDotNetmapfile
MapTopicsetCompare.csDitaMapTopicsetCompareDotNetmts | mts-inplace
GeneralCompare.csDitaCompareDotNet(empty)
Program.cs(none - the startup class)(not-applicable)

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