JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris 11.1 Desktop Administrator's Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information


1.  Administering the Oracle Solaris Desktop

2.  Managing User Preferences With GConf

3.  Customizing Menus

4.  Installing Themes

5.  Customizing Fonts

6.  Working With MIME Types

MIME Types Overview

About the MIME Database

MIME Database Contents

Refreshing the MIME Database

Understanding MIME Type XML Files

Modifying MIME Types

How to Add or Modify MIME Types

Registering Applications for MIME Types

How to Register Applications for MIME Types

How to Associate a MIME Type With an Application

7.  Managing Screensavers

8.  Managing Sessions

9.  Overview of the Yelp Help Browser

10.  Improving the Performance of the Oracle Solaris Desktop System

11.  Disabling Features in the Oracle Solaris Desktop System

12.  Working With the X Window System

A.  Hidden Directories



Understanding MIME Type XML Files

The MIME XML files provide all the information regarding MIME types that are installed into the MIME database by the update-mime-database application. The MIME XML files are located in the <MIME>/packages directory. A few rules about the MIME XML files:

By default, the file is installed to the packages directory in one of the <MIME> paths (usually /usr/share/mime/ packages).

The following table gives a brief description of each element that can occur as children to the mime-type element.

Table 6-1 Child elements of <mime-type>

Element (and attributes)
<glob pattern="*.xyz">
This element specifies a glob pattern for the filenames. If the filename matches, then the file is assigned the MIME type of the parent mime-type element.

The pattern attribute is mandatory.

<magic priority="50">
This element contains a list of match elements as its children.

The priority attribute is optional, and specifies a priority between 0 and 100, with 100 being the highest matching priority. Each child match element has three required attributes and an optional attribute:

  • type

  • offset

  • value

  • mask (optional attribute)

For details about these attributes, see the XDG shared mime info specification.

<alias type="media/subtype">
This element defines an alias for the parent mime-type element. For example, application/x-pdf is an alias for the application/pdf MIME type.
<sub-class-of type="media/subtype">
This element defines the parent mime-type element as a subclass of the MIME type specified in the type attribute. For example, image/svg is a subclass of the text/xml, text/plain, and application/octet-stream MIME types.
<comment xml:lang="locale">
This element provides a readable description for the MIME type. There can be zero or more occurrences of this element as long as each one contains a unique value for the xml:lang attribute.
<root-XML namespaceURI="namespace" localName="">
If a file is determined to be an XML file, then this element helps to further classify the file type by using the namespaceURI and localName attributes. The namespaceURI attribute is the namespace of the document, and localName is the name of the root element for the document. If localName is present but the value is empty, then the root element might have any name but the namespace must still match.

The following example defines the text/x-diff MIME type.

Example 6-1 Example of a diff.xml source XML file:

<?xml version='1.0'?>
<mime-info xmlns=''>
<mime-type type="text/x-diff">
    <comment>Differences between files</comment>
    <comment xml:lang="af">verskille tussen lêers</comment>
    <!-- more translated comment elements -->
    <magic priority="50"> <match type="string" offset="0" value="diff\t"/>
        <match type="string" offset="0" value="***\t"/>
        <match type="string" offset="0" value="Common subdirectories: "/>
    <glob pattern="*.diff"/>
    <glob pattern="*.patch"/>

In this example, multiple comment elements give a readable name to the MIME type in a number of different languages. The text/x-diff MIME type has rules for matching both through glob patterns and through the use of content sniffing (known as magic rules). Any file with the .diff or .patch extension will resolve to this MIME type. Additionally, any file whose contents start with the strings specified in the value attributes of the match element will resolve to the text/x-diff MIME type. For more details about the glob patterns and magic rules, see the XDG shared mime info specification.