Java Desktop System Release 3 Administration Guide

Structure of the MIME Database

The following is a sample from the MIME type database:

<mime-type type="image/png">
		<comment>PNG image</comment>
		<comment xml:lang="de">PNG-Grafik</comment>
		:
		:
		:
		<magic priority="50">
			<match offset="0" type="string" value="\x89PNG" />
		</magic>
		<glob pattern="*.png" />
	</mime-type>

Table 5–1 describes the elements in the MIME type database.

Table 5–1 MIME Type Database Elements

Element 

Description 

mime-info

This is the document element, or highest level element in the MIME database. This element contains the required information for all MIME types. The namespace URI of this element is as follows:  

http://www.freedesktop.org/standards/shared-mime-info

mime-type

Describes one MIME type. This element has a type attribute, which specifies the MIME type.

comment

Provides a description of the MIME type that is used in the user interface. The description can be displayed in the file manager and other applications. 

The database might contain comment elements with xml:lang attributes. These elements can provide the descriptive text in other languages.

magic

Contains match elements. The match elements specify a particular pattern to search for in the contents of a file.

This associates a specific pattern in a file with the MIME type specified in the mime-type element. If an application finds a match for the pattern, the MIME type associated with the pattern is the MIME type of the file.

The magic element includes a priority attribute. You can specify a priority value for the pattern. If there are identical patterns in the magic elements in the MIME database, the element with the highest priority value takes precedence.

For more information about the attributes of a match element, see Attributes in Match Elements.

glob

Specifies a filename pattern to match with the MIME type. Any file that matches this filename pattern takes this MIME type.  

root-XML

If a file is identified as an XML file, you can associate a more specific MIME type than text/xml with the file. To do this, you assign values to the following attributes of the root-XML element:

  • namespaceURI: Type a namespace that uniquely identifies the type of XML file.

  • localName: Type a local name for the XML file. This name uniquely identifies the MIME type within the namespace of the XML file.

This element is optional. This element is not present in the example.