What is XML?
XML (Extensible Markup Language) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.
Quick Facts
| Full Name | Extensible Markup Language |
|---|---|
| Created | 1998 by W3C |
| Specification | Official Specification |
How XML Works
XML uses tags to define elements, similar to HTML but with custom tag names. Every opening tag must have a corresponding closing tag, and elements must be properly nested. XML supports attributes within tags, namespaces for avoiding naming conflicts, and schemas (XSD) for validation. While JSON has largely replaced XML for web APIs, XML remains important in enterprise systems, document formats (DOCX, SVG), and configuration files.
Key Characteristics
- Self-describing with custom tag names
- Strict syntax - must be well-formed
- Supports namespaces for element disambiguation
- Schema validation with XSD or DTD
- Supports comments, CDATA sections, and processing instructions
- Platform and language independent
Common Use Cases
- Enterprise data exchange (SOAP, EDI)
- Document formats (Microsoft Office, SVG, RSS)
- Configuration files (Maven, Android, Spring)
- Data storage and archival
- Web services (SOAP APIs)