Item 45. Pick the Correct MIME Media Type

XML processors, web browsers, and many other tools rely on MIME media types to dispatch XML content to the correct processor. Just a few minutes ago I got an e-mail from an annoyed reader because I'd published some SVG pictures with the MIME type text/xml instead of application/xml+svg, so his SVG viewer couldn't read them. It's not hard to set the correct MIME type in most web servers. However, most existing servers ship with incorrect or incomplete MIME types, so you probably have to fix your server's configuration before publishing.

Pure, undifferentiated XML comes in two flavors:

  1. text/xml; charset=“iso-8859-2”

  2. application/xml; charset=“utf-16be”

If no more specific MIME type has been registered for ...

Get Effective XML: 50 Specific Ways to Improve Your XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.