Media type · application/xml

application/xml

application/xml is the media type for generic XML documents.

Key facts

Typeapplication/xml
Extensions.xml
StandardRFC 7303
Text or binaryText
Legacy alternativetext/xml

What application/xml is

It identifies an XML document whose vocabulary is not otherwise registered. RFC 7303 prefers application/xml for generic XML and reserves text/xml for compatibility. The optional charset parameter should agree with the encoding declared in the XML declaration.

Encoding and parsing failures

An XML parser reads the declaration <?xml version="1.0" encoding="UTF-8"?> and the byte stream. If the HTTP charset and the declaration disagree, the parser may fail or misread characters. A byte-order mark can also confuse naive parsers. Validate the document independently of the transport: a well-formedness error is different from a schema violation.

Frequently asked questions

Is application/xml better than text/xml?

RFC 7303 prefers application/xml for generic XML. text/xml remains for compatibility but is not the default choice.

Why does my XML fail to parse after upload?

Check encoding first — a mismatch between the HTTP charset and the XML declaration is a common cause. Then check well-formedness, such as an unclosed tag.

New tools, straight to your inbox

One short email when we add tools worth using. No spam, unsubscribe anytime.