text/xml vs application/xml

Christian Neumair chris at gnome-de.org
Thu Dec 1 20:50:51 EET 2005


On Di, 2005-11-22 at 16:08 +0100, Eric van der Vlist wrote:
> I came on the share mime type database no later than yesterday and I
> hope I am not raising a permathread (that doesn't seem to be the case
> according to my googling, but you can never know!)...
> 
> The "text/xml" mime type is often considered harmful and many people
> prefer to use application/xml instead.
> 
> The reason why this is the case is that mime types are still described
> by the RFC 2045 and 2046 and that RFC 2046 says that the default
> encoding for all the text/* types is ASCII:
> 
> "The default character set, which must be assumed in the absence of a
> charset parameter, is US-ASCII."
> 
> Being conform to this statement means that any "text/xml" document
> served on an HTTP server that do not specify a charset or a file system
> that doesn't provide this information MUST be considered as ASCII and
> that invalidates a majority of XML documents (at least out of English
> speaking countries). 
> 
> This has been commented a couple of articles on XML.com:
> 
>       * http://www.xml.com/pub/a/2004/07/21/dive.html
>       * http://www.xml.com/pub/a/2005/06/08/restful.html
> 
> I don't know the implications of making such a change on existing
> applications, but the a suggestion would be to declare the XML type as
> "application/xml" with an alias "text/xml" and having "text/plain" as a
> sub class.
> 
> Would that make sense?

Thanks for sharing your thoughts with us!

Unfortunately, I think many implementations are broken wrt this very
subtle RFC detail. For now, I've decided to make "application/xml" the
main XML MIME type, add "text/xml" as an alias, and make all the
previously "text/xml" subclassed MIME types descendants of
"application/xml" [1,2]. I think charset detection is really out of
scope for our MIME package.

[1]
http://cvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml.in?r1=1.98&r2=1.99
[2]
http://cvs.freedesktop.org/mime/shared-mime-info/ChangeLog?r1=1.152&r2=1.154


> PS: I am wondering how you deal with these charset issues beyond XML and
> may have missed something here, see:
> http://eric.van-der-vlist.com/blog/1614_The_complex_simple_problem_of_media_types.item

-- 
Christian Neumair <chris at gnome-de.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/xdg/attachments/20051201/24c25c95/attachment.pgp 


More information about the xdg mailing list