Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valid content-type for XML, HTML and XHTML documents

People also ask

What is the Content-Type for XML?

This document standardizes three media types related to XML MIME entities: application/xml, application/xml-external-parsed-entity, and application/xml-dtd while deprecating text/xml and text/xml-external-parsed-entity. Registration information for these media types is described in the sections below.

Is XML Valid HTML?

And similarly vice versa, if you keep XML simple enough it can be valid HTML.

What is application xhtml XML?

The 'application/xhtml+xml' media type [RFC3236] is the primary media type for XHTML Family documents. 'application/xhtml+xml' should be used for serving XHTML documents to XHTML user agents (agents that explicitly indicate they support this media type).

Is XML MIME type?

There are two MIME assignments for XML data. These are: application/xml (RFC 7303, previously RFC 3023) text/xml (RFC 7303, previously RFC 3023)


HTML: text/html, full-stop.

XHTML: application/xhtml+xml, or only if following HTML compatbility guidelines, text/html. See the W3 Media Types Note.

XML: text/xml, application/xml (RFC 2376).

There are also many other media types based around XML, for example application/rss+xml or image/svg+xml. It's a safe bet that any unrecognised but registered ending in +xml is XML-based. See the IANA list for registered media types ending in +xml.

(For unregistered x- types, all bets are off, but you'd hope +xml would be respected.)