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.
Warning
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,
"http://tinytim.sourceforge.net/examplemap.ctm");
writer.write(tm);
If the input is the following CTM fragment:
tinyTiM; - "tinyTiM, the tiny Topic Maps engine".
The CXTM result would be
<topicMap>
<topic number="1">
<itemIdentifiers>
<locator>#tinyTiM</locator>
</itemIdentifiers>
<name number="1">
<value>tinyTiM, the tiny Topic Maps engine</value>
<type topicref="2"></type>
</name>
</topic>
<topic number="2">
<subjectIdentifiers>
<locator>http://psi.topicmaps.org/iso13250/model/topic-name</locator>
</subjectIdentifiers>
</topic>
</topicMap>