XML
Extensible Markup Language
MIME type: application/xml
XML is a markup language designed to store and transport data in a human-readable and machine-readable format. It's widely used in web services, configuration files, and data interchange.
Advantages
- +Human-readable and self-descriptive
- +Platform and language independent
- +Supports complex hierarchical data
- +Extensive tooling and validation (XSD, DTD)
Limitations
- -Verbose — much larger than JSON or CSV
- -Slower to parse than JSON
- -Complex syntax rules
- -Being replaced by JSON in many modern use cases
Common Use Cases
Technical Details
XML documents consist of elements delimited by start and end tags, with attributes as name-value pairs. Well-formed XML must have a single root element, properly nested tags, and quoted attribute values. Validation can use DTD (Document Type Definition) or XSD (XML Schema Definition).
Frequently Asked Questions
What is XML used for?
XML is used for storing structured data, configuration files, web service communication (SOAP), RSS feeds, and as the basis for document formats like DOCX and SVG.
XML vs JSON — which should I use?
JSON is simpler, lighter, and faster to parse — use it for web APIs and modern applications. XML is more powerful for complex documents with validation requirements, namespaces, and mixed content.