Oracle® Solaris 11.2 Desktop Administrator's Guide

Exit Print View

Updated: July 2014
 
 

MIME Database Contents

    The MIME database contains the following directories and files:

  • <MIME>/packages/

  • <MIME>// media /subtype.xml

  • <MIME>/globs

  • <MIME>/magic

  • <MIME>/XMLnamespaces

  • <MIME>/aliases

  • <MIME>/subclasses

    The following is a list of MIME directories and files in the MIME database with a brief description :

  • <MIME>/packages/– This directory can contain any number of XML files. Each XML file describes the collection of MIME types. The freedesktop.org.xml file located in the <MIME>/packages/ directory contains all the default MIME types that are widely used and recognized. By default, the freedesktop.org.xml file is installed in the /usr/share/mime/packages directory.

    Applications that provide information about new MIME types install a single new XML file in this directory. Depending on the prefix where the application is installed, the file is created in the /mime/package subdirectory. For example, an application installed in the /usr/bin directory should install a new source XML file in the /usr/share/mime/packages directory. For more information about the XML files in the packages directory, see Understanding MIME Type XML Files.

  • <MIME>/ media/ subtype.xml– These directories and files are automatically generated from the collection of source XML files in the <MIME>/packages/ subdirectory by the update-mime-database application. For example, for each mime-type element in the /usr/share/mime/packages/freedesktop.org.xml file, a directory is created in the /usr/share/mime/ directory with the media type of the MIME type. Along with the media type, an XML file is also created in that directory with the subtype identifier of that MIME type. The contents of the created XML file include comments and translations, subclasses designations, and aliases.

    The following example is an excerpt from the file generated by the update-mime-database application, using the freedesktop.org.xml default source XML file.

    <?xml version='1.0' encoding='utf-8'?>
    <mime-type 
    xmlns="http://www.freedesktop.org/standards/shared-mime-info"
    type="text/plain">
    <!--Created automatically by update-mime-database.
    DO NOT EDIT!-->
    	<comment>
    	plain text document
    	</comment>
    	<!-- possibly more translations-->
    	<comment xml:lang="es">
    	documento de texto sencillo
    	</comment>
    	<comment xml:lang="eu">
    	testu soileko dokumentua
    	</comment>
    	<comment xml:lang="fi">
    	perustekstiasiakirja
    	</comment>
    	<comment xml:lang="fr">
    	document plein texte
    	</comment>
    	<!-- possibly more translations --> 
    </mime-type> 
  • <MIME>/globs– Each line in this file contains a MIME type and a glob pattern, separated by a colon. The files that match the glob pattern are resolved to the MIME type specified before the colon. There are special rules about how filenames are matched by the glob pattern. For more information, see the XDG shared mime specification.

    This file is also generated by the update-mime-database application, using the freedesktop.org.xml default source XML file.

  • <MIME>/magic– This is a binary file that contains information on how to resolve MIME types by content sniffing (known as “magic rules”). A magic rule is a set of one or more rules that define a file's MIME type by specifying text or binary data to search for at the beginning of the file. For example, you can set a rule to check for the %PDF- string at byte offset 0 in the file. If the string is found, you can assign the file to the application/pdf MIME type.

    This file is also generated by the update-mime-database application.

  • <MIME>/XMLnamespaces– This file contains a mapping of XML namespaces to MIME types. Each line contains three fields:

    • namespace

    • localName

    • MIME type

    Each field is separated by a space. If the localName is empty, then there are two spaces between the namespace and the MIME type fields.

    This file is also generated by the update-mime-database application.

  • <MIME>/aliases– This file contains a list of aliases for each MIME type. An alias is another type of a MIME type. Each line in this file contains two fields :

    • alias name

    • MIME type

    The fields are separated by a space. This file is also generated by the update-mime-database application.

  • <MIME>/subclasses– This file contains a list of subclassed MIME types and their parent MIME type. According to the XDG shared mime specification , a type is a subclass of another type if a ny instance of the first type is also an instance of the second type . For example, all image/svg files are also text/xml, text/plain, and application/octet-stream files. Subclassing is about the format, rather than the category of the data. For example, all spreadsheets do not inherit from a generic spreadsheet class.

    The format of this file is similar to the aliases file. Each line contains two fields:

    • subclassed MIME type

    • parent MIME type

    Each field is separated by a space. This file is also generated by the update-mime-database application.