Exporting Canonical XML Topic Maps (CXTM)ΒΆ

Canonical XML Topic Maps (CXTM) is a format that guarantees that two equivalent Topic Maps Data Model instances will always produce byte-by-byte identical serializations, and that non-equivalent instances will always produce different serializations.

This format is not meant to exchange topic maps but is mainly used to write test cases to ensure that a Topic Maps engine works standard-conform. The Topic Maps Test Suite project provides several test cases that utilise CXTM.


The CXTMTopicMapWriter may modify the topic map instance since it removes duplicate Topic Maps constructs in advance.

Basic usage of the CXTMTopicMapWriter:

import org.tinytim.mio.CXTMTopicMapWriter;

OutputStream out = new FileOutputStream(new File("out.cxtm"));

// Construct a new CXTMTopicMapWriter with the specified base locator
CXTMTopicMapWriter writer = new CXTMTopicMapWriter(out,

If the input is the following CTM fragment:

tinyTiM; - "tinyTiM, the tiny Topic Maps engine".

The CXTM result would be

<topic number="1">
<name number="1">
<value>tinyTiM, the tiny Topic Maps engine</value>
<type topicref="2"></type>
<topic number="2">