Re: XML MIME type recognition



On Tue, Dec 30, 2008 at 04:23:12PM +0100, Bruce van der Kooij wrote:
> 
> It seems application/xml doesn't have a glob associated it with by
> default.

AFACT it does, shared-mime-info-0.51 contains

  <mime-type type="application/xml">
    <comment>XML document</comment>
    <comment xml:lang="be latin">Dakument XML</comment>
    ... many more ...
    <acronym>XML</acronym>
    <expanded-acronym>eXtensible Markup Language</expanded-acronym>
    <sub-class-of type="text/plain"/>
    <generic-icon name="text-html"/>
    <magic priority="40">
      <match value="&lt;?xml" type="string" offset="0"/>
      <match value="&lt;!--" type="string" offset="0"/>
    </magic>
    <glob pattern="*.xml"/>
    <glob pattern="*.xsl"/>
    <glob pattern="*.xslt"/>
    <glob pattern="*.xbl"/>
    <alias type="text/xml"/>
  </mime-type>

> I've never done anything with the mime database or mime types,
> so I couldn't even figure out where the mimetype for XML is supposedly
> defined. However, note the following:
> 
> /usr/local/share/mime/Overrides.xml (note the redefinition for
> application/xml, also note the sub-class-of which doesn't really matter
> in this case but I guess it's good to do anwyays):

Your example really works, although I'm baffled why it works.

Anyway, I'm not distro maintainer.  I want my `third-party' application
to register the new types it supports (well, it should register only
types it owns, but since these are all Scanning Probe Microscopy formats
the chance of something else registering them is essentially zero).  So
neither Overrides.xml, intended for local admin changes, nor redefining
standard MIME type such as application/xml seems appropriate.

> http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.11.html

I've read

http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-0.18.html

countless times...   According to the recommended checking order, if I
just add glob for "*.xml" with the default weight, it should cause
conflict and resort to magic -- which would in turn result in correct
detection.  Perhaps this is just unimplemented in nautilus as it simply
makes all *.xml files application/x-smpl-spm if I do this.

It the choice is, at this moment, between not having one my type
detected properly and possibly breaking all other XML files, I will do
with the former...

Thanks for your help,

Yeti



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