[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

MIME updates

Here are my proposed changes to the MIME spec. This adds <sub-class-of>
and <alias> for KDE. It also makes a couple of other clarifications.

If someone could put me (talex) in the 'mime' group on the new CVS server,
I'll commit the changes.

You can also find the new version on the web:


--- shared-mime-info-0.11/shared-mime-info-spec.xml	2003-04-17 16:16:39.000000000 +0100
+++ /home/tal00r/Projects/shared-mime-info/shared-mime-info-spec.xml	2003-10-09 13:22:29.000000000 +0100
@@ -495,7 +257,20 @@
 <manvolnum>1</manvolnum></citerefentry>'s <filename>magic.mime</filename> file.
 They can be nested in the same way to provide the equivalent of continuation
+lines. That is, <![CDATA[<a><b/><c/></a>]]> means 'a and (b or c)'.
+				</para></listitem>
+				<listitem><para>
+<userinput>alias</userinput> elements indicate that the type is also sometimes
+known by another name, given by the <userinput>type</userinput> attribute. For
+example, <userinput>audio/midi</userinput> has an alias of
+<userinput>audio/x-midi</userinput>. Note that there should not be a
+<userinput>mime-type</userinput> element defining each alias; a single
+element defines the canonical name for the type and lists all its aliases.
+				</para></listitem>
+				<listitem><para>
+<userinput>sub-class-of</userinput> elements indicate that any data of this
+type is also some other type, given by the <userinput>type</userinput>
+attribute. See <xref linkend="subclassing"/>.
 <userinput>comment</userinput> elements give a human-readable textual description of the MIME
@@ -719,6 +495,42 @@
 implementations MUST NOT rely on this method being available.
+	<sect2 id="subclassing">
+		<title>Subclassing</title>
+		<para>
+A type is a subclass of another type if any instance of the first type is
+also an instance of the second. 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 catagory of the data (for example, there is no
+'generic spreadsheet' class that all spreadsheets inherit from).
+		</para>
+		<para>
+Some subclass rules are implicit:
+			<itemizedlist>
+<listitem><para>All text/* types are subclasses of text/plain.</para></listitem>
+<listitem><para>All streamable types (ie, everything except the inode/* types)
+are subclasses of application/octet-stream.</para></listitem>
+			</itemizedlist>
+In addition to these rules, explicit subclass information may be given using
+the <userinput>sub-class-of</userinput> element.
+		</para>
+		<para>
+Note that some file formats are also compressed files (application/x-jar files
+are also application/zip files). However, this is different to a case such as a
+compressed postscript file, which is not a valid postscript file itself (so
+application/x-gzpostscript does not inherit from application/postscript,
+because an application that can handle the latter may not cope with the
+		</para>
+		<para>
+Some types may or may not be instances of other types. For example, a
+spreadsheet file may be compressed or not. It is a valid spreadsheet file
+either way, but only inherits from application/x-gzip in one case. This
+information cannot be represented statically; instead an application
+interested in this information should run all of the magic rules, and
+use the list of types returned as the subclasses.
+		</para>
+	</sect2>
 		<title>Recommended checking order</title>
@@ -758,6 +574,24 @@
+		<title>Non-regular files</title>
+		<para>
+Sometimes it is useful to assign MIME types to other objects in the filesystem,
+such as directories, sockets and device files. This could be useful when looking up
+an icon for a type, or for providing a textual description of one of these objects.
+The media type 'inode' is provided for this purpose, with the following types corresponding
+to the standard types of object found in a Unix filesystem:
+		</para>
+		<simplelist>
+			<member>inode/blockdevice</member>
+			<member>inode/chardevice</member>
+			<member>inode/directory</member>
+			<member>inode/fifo</member>
+			<member>inode/socket</member>
+			<member>inode/symlink</member>
+		</simplelist>
+	</sect2>
+	<sect2>
 		<title>Security implications</title>
 The system described in this document is intended to allow different programs

Thomas Leonard			http://rox.sourceforge.net
tal00r at ecs.soton.ac.uk	tal197 at users.sourceforge.net
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]