application/xml MIME Type — XML Content-Type & HTTP Examples
Extensible Markup Language. A general-purpose markup format for structured data. Used in SOAP web services, RSS/Atom feeds, SVG, and configuration files. Has largely been replaced by JSON for APIs but remains dominant in enterprise and document contexts.
Used For
- Sitemaps (sitemap.xml)
- RSS and Atom feeds
- SOAP web services
- SVG images
- Office documents (OOXML)
HTTP Header Example
POST /soap-service HTTP/1.1
Content-Type: application/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<root><element>value</element></root>Code Examples
// Express — return XML response
import { create } from 'xmlbuilder2'
app.get('/feed.xml', (req, res) => {
const xml = create({ version: '1.0' }).ele('rss').ele('channel').up().end({ prettyPrint: true })
res.set('Content-Type', 'application/xml').send(xml)
})
// Fetch XML
const response = await fetch('/api/data.xml')
const text = await response.text()
const parser = new DOMParser()
const doc = parser.parseFromString(text, 'application/xml')Related MIME Types
Frequently Asked Questions
What is the application/xml MIME type?
Extensible Markup Language. A general-purpose markup format for structured data. Used in SOAP web services, RSS/Atom feeds, SVG, and configuration files. Has largely been replaced by JSON for APIs but remains dominant in enterprise and document contexts.
When should I set Content-Type: application/xml?
Set Content-Type: application/xml on HTTP responses that contain XML data. Sitemaps (sitemap.xml).
What file extensions use application/xml?
Files with application/xml content typically use these extensions: .xml, .xsl, .xsd.
What happens if I serve this with the wrong Content-Type?
Browsers use the Content-Type header to decide how to handle the response. Serving application/xml content with an incorrect MIME type can cause browsers to display it incorrectly, refuse to execute it (scripts), or prompt an unintended download. Modern browsers respect X-Content-Type-Options: nosniff and will not attempt to auto-detect the type.
