Skip Navigation Links | |
Exit Print View | |
Oracle Solaris 11.1 Desktop Administrator's Guide Oracle Solaris 11.1 Information Library |
1. Administering the Oracle Solaris Desktop
2. Managing User Preferences With GConf
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
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
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:
The XML file must specify the namespace as http://www.freedesktop.org/standards/shared-mime-info.
The root element must be mime-info.
Zero or more mime-type elements can be specified as children of the mime-info element. The type attribute is used to specify the MIME type that is being defined.
By default, the freedesktop.org.xml 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>
|
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='http://www.freedesktop.org/standards/shared-mime-info'> <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: "/> </magic> <glob pattern="*.diff"/> <glob pattern="*.patch"/> </mime-type> </mime-info>
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.