XML MIME Type

Learn what text/xml identifies, how it relates to application/xml, how to open XML files, and how Poly previews and searches them.

MIME type details for text/xml

In active use
MIME typetext/xml
Extensions
.xml
Alternate versions
application/xml
First standardized1998
Created byWorld Wide Web Consortium and Internet Engineering Task Force
Browser supportChrome, Edge, Firefox, Opera, Safari
Example applicationsOxygen XML Editor, Visual Studio Code
Poly supportYes. Poly recognizes XML supplied as `text/xml` and treats readable UTF-8 source as text.
Indexed by PolyYes. Poly indexes readable UTF-8 XML source for full-text and semantic search. It does not interpret schemas or execute transformations.
Preview in PolyYes. XML opens in Poly's code editor with source-oriented syntax highlighting.
Poly agentYes. The Poly agent can read and reason about readable UTF-8 XML source, but it does not automatically fetch external schemas or entities.

What does text/xml represent?

The text/xml media type identifies a well-formed Extensible Markup Language document. XML provides syntax for structured text rather than a fixed vocabulary. A file might describe configuration, a data exchange message, a document, or an application-specific record. Its element names and meaning come from the vocabulary that uses XML.12

The registered extension is .xml. There is no dependable magic number. UTF-8 files often begin with <?xml, but an XML declaration is optional, and a document can begin with a byte-order mark, whitespace, or other permitted content. UTF-16 documents use different byte patterns. Identification should combine the media type, filename, encoding signals, and successful XML parsing.1

A document can be well-formed without being valid. Well-formed XML follows the core syntax, including one root element and properly nested tags. Valid XML also satisfies the constraints of an associated DTD or schema.2

Is text/xml the same as application/xml?

For an XML document entity, yes in representation and current processing rules. RFC 7303 defines text/xml as an alias whose registration is the same as application/xml except for the top-level type. It recommends application/xml for new uses to avoid confusion left by older character-encoding rules.1

Propertytext/xmlapplication/xml
ContentXML document entityXML document entity
Required parametersNoneNone
Optional parametercharsetcharset
Registered extension.xml.xml
Current guidanceCommon aliasRecommended generic type

Use a more specific registered type when the XML vocabulary has one. Examples include image/svg+xml, application/atom+xml, and application/xhtml+xml. The +xml suffix tells generic tools that the representation uses XML while preserving the application's more precise meaning.1

Changing a Content-Type header does not transform the document. It only changes how a recipient is told to interpret the existing bytes.

History of XML and its media type

W3C published XML 1.0 as a Recommendation on February 10, 1998. The work created a standardized, platform-neutral way to define and exchange structured document formats on the web.3

The IETF registered text/xml and application/xml in RFC 2376 in July 1998. RFC 3023 replaced that document in 2001, and the current RFC 7303 replaced RFC 3023 in 2014. The newer rules align character-encoding handling for the text/ and application/ forms while retaining text/xml for compatibility.14

How to open and inspect an XML file

Current browsers can display unstyled XML source, while an xml-stylesheet processing instruction can associate CSS or XSLT for a more deliberate presentation.5 For editing and validation, use a source editor or an XML-aware tool. Oxygen XML Editor, for example, provides text, structured, and authoring views for XML document types.6

Before trusting the filename:

  1. Confirm the declared or detected character encoding.
  2. Parse the file with an XML parser and check that it is well-formed.
  3. Inspect the root element and namespace to identify the vocabulary.
  4. Validate against the correct schema when the workflow requires validity.
Prefer UTF-8 for interchange. RFC 7303 identifies character encoding as XML's largest recurring interoperability problem and recommends UTF-8 with careful, consistent encoding labels.1

Support in Poly

Poly recognizes files identified as text/xml as text. Readable UTF-8 XML opens in the code editor with source-oriented highlighting. Poly indexes the source for exact and semantic search, and the Poly agent can read and reason about that source.

This support is source-focused. Poly does not validate the file against a DTD or schema, run XSLT, resolve application-specific semantics, or turn an arbitrary XML vocabulary into a custom visual interface. XML encoded as UTF-16 or another non-UTF-8 encoding may need conversion to UTF-8 before these text features work reliably.

Converting XML to another format

XML is a syntax family, so there is no universal XML-to-JSON, XML-to-CSV, or XML-to-HTML conversion that preserves every document. Choose the destination only after identifying the vocabulary and the information that matters.

  • JSON works well for many application data exchanges, but attributes, mixed text and element content, namespaces, comments, and ordering need explicit mapping rules.
  • CSV suits flat tables. Nested elements and repeated groups must be flattened or split into related tables.
  • HTML is appropriate for browser presentation. XSLT or application code can transform a known XML vocabulary into HTML.
  • Plain text is useful when only human-readable content matters and the markup structure can be discarded.

Keep the original until the converted result has been validated. A syntactically successful conversion can still lose namespaces, type information, document order, comments, or application-specific metadata.

XML security and privacy

Treat unfamiliar XML as untrusted input. XML can reference external entities, DTDs, style sheets, and transformations. A parser that retrieves external resources can leak data or make unexpected network requests. Repeated entity expansion can also consume excessive memory or processing time.1

When configuring a parser, disable external entity and network access unless the application genuinely needs them. Apply limits to document size, nesting, and entity expansion, and validate the expected root element and namespace before using the data.

XML can also carry sensitive information that is not obvious in a rendered view, including comments, processing instructions, identifiers, internal paths, and application metadata. Review the source before publishing or sharing it.

Common questions

Is every .xml file text/xml?

Not necessarily. The extension says the bytes are probably XML, but a specific vocabulary may have its own media type. SVG, Atom, XHTML, and many industry formats should use their registered type when it is known. Generic XML document entities can use application/xml or its text/xml alias.1

Does <?xml prove that a file is XML?

No. It is a useful clue, not a fixed signature. The declaration is optional, can vary by encoding, and can be copied into a malformed or unrelated file. A conforming parser must still check the complete document.

Are XML and HTML interchangeable?

No. HTML defines a web-document vocabulary and browser error-recovery rules. XML defines a strict syntax for many possible vocabularies. A browser may repair malformed text/html, while an XML parser must report a well-formedness violation as a fatal error.2

Footnotes

  1. Internet Engineering Task Force. RFC 7303: XML Media Types. Defines the current application/xml registration, the text/xml alias, the .xml extension, encoding guidance, the +xml convention, and security considerations. 2 3 4 5 6 7 8
  2. World Wide Web Consortium. Extensible Markup Language (XML) 1.0, Fifth Edition. Defines XML documents, well-formedness, validity, nesting, characters, and encoding requirements. 2 3
  3. World Wide Web Consortium. W3C Issues XML 1.0 as a Recommendation. Records the February 10, 1998 publication and the standard's interoperability goals.
  4. Internet Engineering Task Force. RFC 2376: XML Media Types. Introduced text/xml and application/xml in July 1998 and is now obsolete.
  5. MDN Web Docs. XML Introduction. Explains raw browser display and styling XML with CSS or XSLT.
  6. Syncro Soft. Editing Supported Document Types in Oxygen XML Editor. Describes XML text, author, grid, validation, and transformation features.
© Poly Corp. 2026