THE FILE FIELD GUIDE
.xml

XML Data

Web & Development

XML is a tagged data syntax used for many purposes, including sitemaps and settings. Well-formed tags do not guarantee a document matches the consuming application’s requirements.

What it is used for
Tagged structured documents, settings and data exchange
What the file contains
Text
All sections, questions and sources

Content reviewed: · Editor:Kai

Opening steps

Choose your environment or purpose to see its steps.

Editor: inspect the structure

Make a copy before saving.

  1. Open in an editor such as VS Code and select the appropriate language mode.
  2. Inspect tags, attributes, namespaces and declared encoding.
  3. Inspect encoding and line endings and avoid saving as rich text.
Syntax: use an XML parser

Separate well-formedness from schema validity.

  1. Parse a copy with a local XML validation tool.
  2. Inspect tag closure, quotes and special characters around the first error.
  3. Validate against the specified DTD/XSD where needed and inspect external-reference settings.
Application: use the proper importer

XML is a structure; its application depends on the producer.

  1. Identify the producer, schema and namespaces.
  2. Select the copy in the receiving application’s XML importer.
  3. Compare counts, attributes, text and ordering.

Menu labels and support vary by app, OS and version. Preserve the original before making changes.

Troubleshooting by symptom

  • Parse failure: inspect closing tags, quotes, nesting and escaped special characters.
  • Blank display: XML does not define a generic HTML-like presentation; use the intended application.
  • Application rejects content: inspect namespaces, required elements, version and schema.
  • Ampersand error: inspect required escaping of & or < in text.
  • Matching tag names are rejected: inspect namespace URIs and prefix mappings.
  • Declaration/encoding mismatch: inspect the actual saved encoding rather than changing the declaration alone.

XML → JSON / CSV

  1. Map elements, attributes and repeated nodes to the destination structure.
  2. Convert a copy and inspect omissions, ordering, encoding and types.
  3. Compare keys, record counts and types before/after conversion and document unsupported items.

Attributes, namespaces and mixed text/element content may not fit a simple table.

Elements, attributes and text

Distinguish attribute values from element text. Check formatting effects where whitespace/order is meaningful.

Successful parsing establishes well-formedness; validate application requirements separately.

<?xml version="1.0" encoding="UTF-8"?>
<item id="1"><name>Example</name></item>

Source for these steps:W3C · XML 1.0 (Fifth Edition) / Python Software Foundation · XML Processing Modules

External references and conversion

XML can reference external entities. Inspect untrusted data with tools that restrict external retrieval.

Compare attributes, namespaces, empty elements and counts after conversion and retain the XML.

Source for these steps:W3C · XML 1.0 (Fifth Edition) / Python Software Foundation · XML Processing Modules

Related-format differences

Related-format differences
FormatMain roleSelection notes
XMLTagged data with attributesInspect schema and namespaces
JSONKey/value hierarchyRequires mapping rules
HTMLWeb documentParsing rules differ from XML

Handling and security

External entities/references require care. Avoid importing unknown XML into administrative systems and use appropriate parser settings.

Questions and answers

Can any application use any XML?

No; identify its schema and intended application.

Is a browser tree view an error?

It can be normal for XML data.

Does renaming XML to HTML create a page?

No; renaming does not transform the document structure.

Is XML specific to Excel?

It has many uses. Choose an application based on the producer’s schema.

Is XML-to-JSON equivalent?

It needs mapping rules for attributes, namespaces, element order and mixed content.

Format facts: name, steward and MIME type
Formal name
Extensible Markup Language
Steward / specification
W3C
MIME type
application/xml

Primary and official sources

  • StandardXML 1.0 (Fifth Edition)

    Defines XML well-formedness, declarations and elements.

    W3C · Link checked:
  • StandardHTML Living Standard

    Specification for HTML documents, elements and resources.

    WHATWG · Link checked:
  • Project documentationXML Processing Modules

    XML parsers and security considerations.

    Python Software Foundation · Link checked: