Document file extension and media type

This topic shows an example on how to set the document file extensions and the media types. This example consists of the following steps:

  1. Set .xml as the default file extension and text/xml as the default file media type.

  2. Set .ditamap extension and application/dita+xml media type for documents with the map element as root element.

  3. Set .dita extension for documents with the topic element as root element.

Step 1

Set .xml as default extension and as default media type.

Add the defaultExtension="xml" and defaultMediaType="text/xml" attributes to the documentFileExtension element.

text/xml is the default media type for human readable XML.

Your documentProcessing.xml should now look like this:

XML

<documentProcessing xmlns="http://schemas.fontoxml.com/connectors/2.0/documentProcessing.xsd">
	<!--Configure the extension for documents-->
	<documentFileExtension defaultExtension="xml"defaultMediaType="text/xml"/>
	<!--Configure the title for documents-->
	<documentFilename defaultFilename="Untitled document"/>
	<!--Configure the path rewriting-->
	<pathRewriting>
	</pathRewriting>
</documentProcessing>

Step 2

Set the .ditamap extension and application/dita+xml media type for documents with the map root element.

  1. Add a fileExtension element with attribute extension="ditamap" and attribute mediaType="application/dita+xml" inside the documentFileExtension element.

  2. Add a rootElement element with attribute name="map" inside the fileExtension element you have just created.

Your documentProcessing.xml should now look like this:

XML

<documentProcessing xmlns="http://schemas.fontoxml.com/connectors/2.0/documentProcessing.xsd">
	<!--Configure the extension for documents-->
	<documentFileExtension defaultExtension="xml" defaultMediaType="text/xml" >
		<fileExtension extension="ditamap" mediaType="application/dita+xml"><rootElement name="map"/></fileExtension>
	</documentFileExtension>
	<!--Configure the title for documents-->
	<documentFilename defaultFilename="Untitled document"/>
	<!--Configure the path rewriting-->
	<pathRewriting>
	</pathRewriting>
</documentProcessing>

Step 3

Set the .dita extension for documents with the topic element as root element.

  1. Add a fileExtension element with attribute extension="dita" inside the documentFileExtension element.

  2. Add a rootElement element with attribute name="topic" inside the fileExtension element you have just created.

Your documentProcessing.xml should now look like this:

XML

<documentProcessing xmlns="http://schemas.fontoxml.com/connectors/2.0/documentProcessing.xsd">
	<!--Configure the extension for documents-->
	<documentFileExtension defaultExtension="xml" defaultMediaType="text/xml" >
		<fileExtension extension="ditamap" mediaType="application/dita+xml">
			<rootElement name="map"/>
		</fileExtension>
		<fileExtension extension="dita"><rootElement name="topic"/></fileExtension>
	</documentFileExtension>
	<!--Configure the title for documents-->
	<documentFilename defaultFilename="Untitled document"/>
	<!--Configure the path rewriting-->
	<pathRewriting>
	</pathRewriting>
</documentProcessing>

Many more variations can be created to configure Fonto Connectors to suit your needs. You should now have enough knowledge to configure the file extensions and media types.