.xml File Extension
.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 type | Extensible Markup Language document |
|---|---|
| MIME type | |
| Encoding | Unicode text, commonly UTF-8 or UTF-16 |
| Operating systems | Windows, macOS, Linux, iOS, Android |
| Opens with | Visual Studio Code, Microsoft Notepad, Apple Xcode, Web browsers |
| Poly support | Yes. Poly provides text-focused support for readable XML files. |
| Indexed by Poly | Yes. Poly indexes readable UTF-8 XML source for exact and semantic search. |
| Preview in Poly | Yes. XML source opens in Poly's code editor with syntax highlighting. |
| Poly agent | Yes. 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.
.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.
| Format | Best fit | Common tradeoff |
|---|---|---|
| XML | Namespaces, mixed content, schemas, document structure | Verbose and parser configuration matters |
| JSON | Web APIs and object-like application data | Attributes and mixed content need mapping rules |
| CSV | Flat rows and columns | Cannot 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
- World Wide Web Consortium. Extensible Markup Language (XML) 1.0, Fifth Edition. Defines XML documents, well-formedness, validity, elements, entities, and character encoding. ↩
- Internet Engineering Task Force. RFC 7303: XML Media Types. Registers the generic XML media types and
.xmlsuffix, recommendsapplication/xml, and documents encoding and security considerations. ↩ ↩2 ↩3 - Microsoft. XML for the Uninitiated. Explains XML structure, well-formed data, schemas, transforms, and text-based recovery. ↩
- World Wide Web Consortium. W3C Issues XML 1.0 as a Recommendation. Records the February 10, 1998 publication and XML's interoperability goals. ↩