Jump to: navigation, search

Generate XML

247 bytes added, 03:38, 7 July 2007
Why doesn't GRAMPS just use a .gz extension?: Clarify pattern/content
GRAMPS uses the [ Shared Mime System] defined by [ Free Desktop] project, and used by all major desktops, including KDE and GNOME. GRAMPS relies on the MIME type identified by the Shared Mime System to determine the file type of the file.
The Share Mime System allows you to identify a file's type by either using a file extension or by looking at the contents of a small section of the file. If The first problem is, usually the filename/extension pattern has the higher priority compared to the contents: if the file is name <code>something.jpg</code> then it is likely to be JPEG image, not text. The second problem is, if we looked at the contents, we would not be able to tell the difference between a gzip'd GRAMPS XML file or any other gzip'd file. If we looked at uncompressed data, we would not be able to tell the difference between a GRAMPS XML file an any and other XML filefiles. For this reasonthese reasons, we must rely on the <ttcode>.gramps</ttcode> extension.
If the GRAMPS XML file had added .gz extension to the name, the Shared Mime system would tell us that the file's type is <ttcode>application/x-gzip</ttcode> instead of the expected <ttcode>application/x-gramps-xml</ttcode>. Unfortunately, it cannot tell us that it is a <ttcode>gzip'd</ttcode> GRAMPS XML file. So, we would not be able to tell if this was a valid file. Even worse, the mime type of <ttcode>application/x-gzip</ttcode> would be associated with another application (such as File Roller or Ark) instead of GRAMPS.
GRAMPS is not unique in this problem. For example, the OpenDocument format used by OpenOffice, KWord and AbiWord is actually a collection of files in a <tt>zip</tt> archive. If you run <tt>unzip</tt> on a OpenDocument file, you will see something like:

Navigation menu