# XML

XML is a text-based markup format for representing structured documents and data using named elements, attributes, and nesting.

- Type: term
- Domain: Engineering & architecture
- Level: Foundational
- Last reviewed: 2026-10-19
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/xml/>)

## What it means

Extensible Markup Language, or XML, defines rules for structured text with elements and attributes. Applications choose their own vocabularies, and namespaces distinguish names from different vocabularies. Well-formed XML follows syntax rules; validation against a declared grammar or schema adds structural constraints. Neither property establishes that the data is meaningful or trustworthy for the receiving business process.

## Why it matters

XML remains part of document formats, feeds, sitemaps, and partner integrations. Understanding its structure helps product teams distinguish parsing failures from schema mismatches and from valid-looking but incorrect business data.

## When to use it

Use XML when an established format or integration contract requires it or when document-oriented structure is useful. For a simple new API, evaluate alternatives such as JSON based on the ecosystem and requirements rather than assuming one format is always superior.

## How it works

1. Identify the expected vocabulary, schema, and encoding.
2. Generate or parse documents with a suitable XML library.
3. Check well-formedness and apply the agreed structural validation where needed.
4. Configure parser features and resource limits appropriately for untrusted input.
5. Validate business rules and report errors at the correct layer.

## A practical example

A hotel partner sends XML availability updates. A feed parses correctly but uses a namespace the importer does not recognize. The team corrects its contract handling rather than treating the empty import as evidence that every hotel is sold out.

## Where it breaks

XML can be verbose, and namespaces or schema evolution complicate integrations. Parser configuration matters for resource use and external resource handling. Structural validity cannot prove that prices, dates, or identifiers satisfy business rules.

## Common mistakes

- Using string substitutions instead of a parser for structured changes.
- Equating well-formed syntax with valid business data.
- Ignoring namespaces because element labels look familiar.

## Sources

1. [Extensible Markup Language \(XML\) 1.0 \(Fifth Edition\)](<https://www.w3.org/TR/xml/>) — W3C · Standard
2. [XML introduction](<https://developer.mozilla.org/en-US/docs/Web/XML/Guides/XML_introduction>) — MDN Web Docs · Official documentation

## Related topics

- [JSON](<https://wiki.soroush.uk/topic/json/>)
- [Database Schema](<https://wiki.soroush.uk/topic/database-schema/>)
- [Application Programming Interface \(API\)](<https://wiki.soroush.uk/topic/application-programming-interface/>)
