.xml File Extension

Learn what a .xml file contains, how to open and validate XML, how Poly supports it, and when JSON or CSV may be a better fit.

File extension details for .xml

Full Support
File typeExtensible Markup Language document
MIME type
EncodingUnicode text, commonly UTF-8 or UTF-16
Operating systemsWindows, macOS, Linux, iOS, Android
Opens withVisual Studio Code, Microsoft Notepad, Apple Xcode, Web browsers
Poly supportYes. Poly provides text-focused support for readable XML files.
Indexed by PolyYes. Poly indexes readable UTF-8 XML source for exact and semantic search.
Preview in PolyYes. XML source opens in Poly's code editor with syntax highlighting.
Poly agentYes. The Poly agent can read and reason about readable XML source.

What kind of file is an .xml?

An .xml file stores structured text using Extensible Markup Language. XML supplies syntax rather than a fixed set of fields, so the same suffix can represent configuration, application data, a document, or a message in an industry-specific vocabulary. Elements, attributes, namespaces, and an optional schema give that data its meaning.1

Generic XML can use application/xml or text/xml. RFC 7303 recommends application/xml for new generic uses and defines text/xml as an alias. A specialized XML vocabulary may instead have a type ending in +xml, such as image/svg+xml.2

There is no universal magic number. <?xml is a useful clue, but the declaration is optional. A byte-order mark, whitespace, comment, or document element may come first, and UTF-16 uses different initial bytes. Confirm the encoding and parse the complete document instead of trusting its name.

Renaming a JSON, HTML, or text file to .xml does not convert it. The contents still need to follow XML's well-formedness rules.

How do I open a .xml on my computer?

For a quick inspection, use a text or source editor:

  • On Windows, open XML with Notepad or Visual Studio Code.
  • On macOS, use Xcode, Visual Studio Code, or another source editor.
  • On Linux, use a desktop text editor, Vim, Emacs, or Visual Studio Code.
  • A current web browser can display many XML files as a collapsible or plain source tree, but it is not a substitute for validation.

If the file belongs to a particular application, open it there first. An XML-aware editor can check well-formedness, validate against a DTD or schema, and apply XSLT. Microsoft notes that human-readable XML can also be inspected in a basic text reader when recovering information from a damaged file.3

Poly support for .xml

Poly opens readable UTF-8 XML in its code editor, indexes the source for exact and semantic search, and makes it available to the Poly agent. This is useful for finding element names, values, configuration settings, or related records across a collection.

Support is source-focused. Poly does not execute transformations, fetch external schemas or entities, or infer the business meaning of every XML vocabulary. Convert UTF-16 or legacy encodings to UTF-8 when preview, search, or agent reading is incomplete.

History of .xml

W3C issued XML 1.0 as a Recommendation on February 10, 1998. The design adapted ideas from SGML into a simpler, platform-neutral format for structured information on the web.4 The IETF registered generic XML media types later that year. RFC 7303 now defines the current media-type and encoding rules, the .xml suffix, and the +xml convention.2

Working with .xml and alternatives

First identify the vocabulary from its root element and namespace. Then validate against the correct schema when the workflow requires more than basic well-formedness.

FormatBest fitCommon tradeoff
XMLNamespaces, mixed content, schemas, document structureVerbose and parser configuration matters
JSONWeb APIs and object-like application dataAttributes and mixed content need mapping rules
CSVFlat rows and columnsCannot directly preserve nested structures

Treat unfamiliar XML as untrusted. External entities can trigger unwanted file or network access, while recursive entity expansion can consume excessive resources. Disable external resource loading unless it is required, apply size and nesting limits, and keep the original until a conversion has been checked for lost namespaces, ordering, comments, and metadata.2

Footnotes

  1. World Wide Web Consortium. Extensible Markup Language (XML) 1.0, Fifth Edition. Defines XML documents, well-formedness, validity, elements, entities, and character encoding.
  2. Internet Engineering Task Force. RFC 7303: XML Media Types. Registers the generic XML media types and .xml suffix, recommends application/xml, and documents encoding and security considerations. 2 3
  3. Microsoft. XML for the Uninitiated. Explains XML structure, well-formed data, schemas, transforms, and text-based recovery.
  4. World Wide Web Consortium. W3C Issues XML 1.0 as a Recommendation. Records the February 10, 1998 publication and XML's interoperability goals.
© Poly Corp. 2026