ietf-corpus

rfc-3023

XML Media Types

M. Murata, S. St. Laurent, D. Kohn
date2001-01 streamLegacy statusPROPOSED STANDARD pages39 canonicalhttps://www.rfc-editor.org/rfc/rfc3023 doi10.17487/RFC3023 errataview
This document standardizes five new media types -- text/xml, application/xml, text/xml-external-parsed-entity, application/xml- external-parsed-entity, and application/xml-dtd -- for use in exchanging network entities that are related to the Extensible Markup Language (XML). This document also standardizes a convention (using the suffix '+xml') for naming media types outside of these five types when those media types represent XML MIME (Multipurpose Internet Mail Extensions) entities. [STANDARDS-TRACK]

obsoleted by

obsoletes

updated by

updates

Extracted elements (30)

design-rationale §A.13

application/xml and application/foo+xml SHOULD be treated as completely independent media types. The '+xml' suffix carries no extra semantics for MIME processors unaware of XML, so there is no implied inheritance or compatibility relationship between them.

design-rationale §1

New XML-specific MIME types were created rather than reusing text/sgml or application/sgml for three reasons: many XML processors cannot handle SGML's larger feature set; SGML processors may not handle XML's technical corrigenda; and the SGML type definitions include SGML-bctf and SGML-boot parameters that are irrelevant and ambiguous for XML.

design-rationale §3.1

The charset parameter is authoritative for text/xml (and overrides any internal XML encoding declaration) because some MIME engines transcode text/* bodies without examining content, because text/xml must fall back gracefully to text/plain behavior, and because RFC 2130 recommends the 'charset' parameter as the standard specification scheme.

design-rationale §A

The '+xml' suffix was chosen over alternatives such as a new subtree, a new top-level type, content sniffing, or MIME parameters because it works within existing MIME registration trees, requires no changes to sending agents, and allows both opaque and generic XML processing to coexist. The '+' character was selected because it semantically conveys that a type is simultaneously both the specific format and XML.

interoperability-note §3

The UTF-16 family of charsets is not allowed for the top-level MIME type 'text' except over HTTP, which uses a MIME-like mechanism exempt from those restrictions. Entities encoded in UTF-16, UCS-4, or UTF-32 cannot be labeled as text/xml outside of HTTP.

http

interoperability-note §3.1

There is a deliberate inconsistency between this specification and HTTP/1.1: text/xml defaults to 'us-ascii' rather than HTTP's historical default of ISO-8859-1. US-ASCII was chosen as the intersection of UTF-8 and ISO-8859-1 and as a better internationalization baseline for a new format.

http

interoperability-note §3.3

XML external parsed entities are prohibited from having standalone document declarations or DTDs, so XML documents cannot be reliably used as external parsed entities and vice versa. Identifying them with distinct content types (text/xml-external-parsed-entity, application/xml-external-parsed-entity) enhances interoperability.

normative-requirement §7 MUST NOT

Accept headers of the form 'Accept: */*+xml' MUST NOT be used in HTTP, because section 14.1 of HTTP/1.1 does not support this pattern.

http

normative-requirement §3 MUST NOT

application/xml and text/xml MUST NOT be used for external parameter entities, external DTD subsets, or external parsed entities unless the entity is also a well-formed document entity referenced as such.

normative-requirement §4 MUST

Applications converting XML from 'utf-16' to a non-Unicode encoding MUST strip the BOM before conversion; when converting from another encoding into 'utf-16', the BOM MUST be added after conversion is complete. Conversions between 'utf-16' and 'utf-16be'/'utf-16le' MUST similarly strip or add the BOM.

normative-requirement §3.2 MUST

For 7-bit MIME transports, data in UTF-8 MUST be encoded in quoted-printable or base64. For 8-bit clean transport, the UTF-16 family MUST be encoded in base64. For binary-clean transports such as HTTP, no content-transfer-encoding is necessary.

http

normative-requirement §3.1 MUST

Gateways from HTTP to other MIME applications MUST transform XML MIME entities from text/xml; charset='utf-16' to application/xml; charset='utf-16', because CR/LF/NUL transformations in MIME applications would corrupt UTF-16 multi-octet characters.

http

normative-requirement §3.1 MUST

If a text/xml entity is received with the charset parameter omitted, MIME processors and XML processors MUST use the default charset value of 'us-ascii', even when transmitted via HTTP.

normative-requirement §3.2 MUST

If an application/xml entity is received with the charset parameter omitted, conforming XML processors MUST follow the requirements in section 4.3.3 of the XML specification to determine the charset. MIME processors that are not XML processors SHOULD NOT assume a default charset.

normative-requirement §8.20 MUST NOT

Processors generating XML MIME entities MUST NOT label conflicting charset information between the MIME Content-Type header and the XML encoding declaration inside the entity.

normative-requirement §3.1 RECOMMENDED

The use of the charset parameter is STRONGLY RECOMMENDED for all XML media types, since it allows XML processors to determine the charset authoritatively and supports charset-based content negotiation in HTTP.

http

normative-requirement §3.1 SHOULD

Unless the received charset is UTF-8 or UTF-16, a recipient that strips the MIME header and stores the XML entity persistently SHOULD also persistently store the charset information, perhaps by embedding a correct XML encoding declaration within the entity.

normative-requirement §7 SHOULD

When a new XML-based MIME media type is introduced, its name SHOULD end with '+xml' to allow generic XML processors to detect and process the entity. Media subtypes that do not represent XML MIME entities MUST NOT be registered with a '+xml' suffix.

registry

normative-requirement §4 MUST

XML MIME entities in the charset 'utf-16' MUST begin with a Byte Order Mark (BOM). Entities in 'utf-16le' or 'utf-16be' MUST NOT begin with the BOM but SHOULD contain an encoding declaration.

protocol-element §3.5

application/xml-dtd is the media type for external DTD subsets and external parameter entities. Neither external DTD subsets nor external parameter entities parse as XML documents, requiring a dedicated type distinct from text/xml and application/xml.

protocol-element §3.2

application/xml is a MIME media type for XML document entities, preferred when the XML content is unreadable by casual users. If the charset parameter is omitted, no charset information is conveyed via MIME, and conforming XML processors must follow XML specification section 4.3.3 to determine encoding.

protocol-element §3.3

text/xml-external-parsed-entity and application/xml-external-parsed-entity are media types for XML external parsed entities. External parsed entities cannot have standalone document declarations or DTDs, so they are not interchangeable with XML document entities and require distinct labeling.

protocol-element §3.1

text/xml is a MIME media type for XML document entities readable by casual users. The charset parameter is optional but strongly recommended; if omitted, the default charset is 'us-ascii'. MIME agents without explicit text/xml support fall back to treating it as text/plain.

json

protocol-element §7

The '+xml' suffix convention is a naming standard for MIME media types that represent XML MIME entities but are not labeled as text/xml or application/xml. Applications may match XML MIME entities by comparing the subtype to the pattern '*/*+xml', enabling generic XML processing across diverse document types.

registry §9

This document registers five new IANA MIME media types: text/xml, application/xml, text/xml-external-parsed-entity, application/xml-external-parsed-entity, and application/xml-dtd. It also updates the RFC 2048 registration process to accommodate the '+xml' suffix convention for future XML-based media types.

registry

security-consideration §10

Any information stored outside the direct control of the user—including CSS stylesheets, XSL transformations, entity declarations, and DTDs—can be a source of insecurity. A 'whiteout attack' on a shared stylesheet, or redefinition of default attribute values in a DTD, can affect documents without modifying them directly. The security of any XML document depends recursively on all externally referenced documents.

security

security-consideration §10

'Entity spoofing' allows attackers to insert malicious text into documents by prepending a declaration that overrides an entity's value; because XML 1.0 permits multiple entity declarations and the first takes precedence, entity references can be redirected to attacker-controlled content.

security

security-consideration §10

Non-recursive entity expansions, though not prohibited, may cause resource exhaustion on finite computing systems if performed many times. Recursive expansions are prohibited by XML and must be detected by XML processors.

security

security-consideration §10

XML, like plain text, can contain escape sequences that alter the display processor environment (e.g., locking the keyboard, changing display parameters, or reprogramming keys). Display processors SHOULD filter such material or reset all settings after display; the ability to program keys SHOULD be blocked by filtering or disabling.

security

wire-format §4

The Byte Order Mark (BOM) for UTF-16 XML MIME entities is the hexadecimal octet sequence 0xFE 0xFF (big-endian) or 0xFF 0xFE (little-endian). ASCII-compatible XML entities often begin with 0x3C 0x3F 0x78 0x6D 0x6C ('<?xml'). The BOM is an encoding signature and is not part of markup or character data.