Don’t call me DOM

19 July 2004

Viewing application/*+xml in Galeon (and possibly other mozilla derivatives)

For quite some time, Mozilla’s bug about not recognizing the application/*+xml MIME Type as an XML Mime Type has made my life harder than it should be; that’s especially true for RDF files served as application/rdf+xml (see the proposed registration of this MIME Type). Enough being enough, I’ve set up a work around this bug in my Gnome 2.6 + Galeon 1.3 set up; it’s not clear how much of this can be re-used in other environments, although I think it’s likely it should work with other Gnome+Mozilla derivatives set up.

The basic idea is to get my browser to understand that application/*+xml is really just like application/xml, unless it knows better. To that end, I first wrote a small CGI script that more or less proxies resources served as application/*+xml into application/xml, by simply rewriting the Content-Type header. Note that it respects the charset parameter if it is set, and also forwards HTTP Authorization requests and responses between the client and the server.

Once this was available and working (as demonstrated by applying it to a W3C RDF file), I needed a way to tell my browser to use this service for the relevant MIME Types; in Gnome (and thus Galeon), this is done using the “File Types and Programs” tool in the advanced preferences menu; I added an RDF entry inside the “Information” category, with the MIME Type application/rdf+xml, and made it handled by a very simple shell script that I had created in my ~/bin directory:


#!/bin/bash
galeon --no-raise -x "http://www.w3.org/2004/07/viewAsXml?uri=$1"

This should have been enough, but the fact that by default, tools that are specified using this tool aren’t supposed to understand URLs, so that Galeon would first download the file in /tmp and then pass /tmp/filename.rdf to my little shell script, making it call the CGI script on a bogus URI…

After some investigation, I found out that adding the following lines in the relevant section of my ~/.gnome/application-info/user.applications configuration file (and despite the warning at the top not to edit it by hand) would finally make my browser do the right thing:


 viewAsXml
        ...
        mime_types=application/rdf+xml
        expects_uris=true
        supported_uri_schemes=http

Now I can view RDF files in my Web browser happily again!

Of course, the real solution would be to solve Mozilla’s bug itself; pending that, this solution could be improved:

  • to work with any Mozilla derivative; I believe that with Mozilla (or Firefox) in Gnome, setting the preference to have it use the systems default should be enough; KDE has probably the same kind of capacity has Gnome in that regard, so this should be easy enough to adapt to that case; for Mozilla alone, I haven’t found a way to configure the mimeTypes.rdf file properly to make it pass the URL along
  • to work with any application/*+xml MIME Type ; right now, it only works for the one you actually specify, but I’m doubtful that the underlying MIME Types system has any capacity to match such a pattern

Picture of Dominique Hazael-MassieuxDominique Hazaël-Massieux (dom@w3.org) is part of the World Wide Web Consortium (W3C) Staff; his interests cover a number of Web technologies, as well as the usage of open source software in a distributed work environment.