XML and MIME

June 11th, 2004 12:06 AM

I don’t like the fact that I have to proxy my requests from web browser (using XMLHttpRequest) to Wordnet because of a MIME type. Wordnet queries are returned as application/rdf+xml, but XMLHttpRequest wants only to deal with text/xml. This is a problem. Not an insurmountable one, but one which reveals poor design.

I seem to recall having a similar conversation with Gary some time ago, and I’m afraid that I might have been defending MIME types like that. And while I still think they’re a good idea, I (now) think using application/*+xml is a terrible idea. The idea, at least as it seems to me now, is that everything served with those MIME types is in XML. The fact that the XML can be interpreted as RDF seems like the job for a MIME parameter, or something.

Comments

… I might have been defending MIME types like that. And while I still think they’re a good idea, I (now) think using application/*+xml is a terrible idea.

ok, you knew you were gonna get flack from me for this when you wrote it. how can you think they’re a good idea and a terrible idea both at the same time (and in the same sentence too!)?

and if you want to put RDF into XML and still be able to identify both, it seems to me you should be tagging it with a MIME type of application/rdf and then adding something akin to “Content-Disposition: xml” (but of course using a different header since that one’s taken already). or you can use MIME parameters as you say.

unlike many XML formats, the fact that your RDF is in XML is really secondary to it being RDF. that is: an RDF parser should be able to deal with the XML and pull out a proper RDF graph; an XML parser, while it will be able to parse the XML representation, will not be able to make much use of the content. actually, i guess the same could be said of many XML formats.

and yes, i’m actually going against my earlier argument, which was to use text/xml for all XML files. but the whole point of MIME is to tag files with which application can open them. using text/xml is like using application/octet-stream. sure, they both accurately describe the file, but it’s completely useless as they also don’t differentiate one file from another. what we really need is faceted MIME types <g>

Posted by: gary on June 11th, 2004 5:16 AM

I still think that the concept of mime types is a valuable one, but I’m less sold on the idea of using the specific form application/*+xml which tries to be faceted, but ends up screwing up things like the XMLHttpRequest object.

While I can see your point on having RDF have a type of application/rdf, I still think a straight xml type would be better. This is because RDF doesn’t strike me as a media type. The problem here is that serving RDF/XML as RDF and not XML stops you from doing things like parsing RDF in Javascript using the XMLHttpRequest which seems like a legitimate use case to me. Yes, serving it as RDF also makes sense, but that is breaking what I want to do.

I’m not sure either of us is entirely right. I think things like the XMLHttpRequest object should probably be more forgiving, and I think we should think more about how faceted data should be classified by things like MIME. But in the end, what I’m trying to say is that the MIME type issues are a real problem based on available tools and current use cases.

Posted by: kasei on June 11th, 2004 9:49 AM