.XML
Extensible Markup Language
Introduction
XML is a text format for documents and data made of nested, named elements. The W3C published XML 1.0 in 1998 as a simpler form of SGML. XML itself only sets the syntax; each use defines its own elements, often with a schema that a validator can check.
Many other formats are XML underneath, including
SVG images, GPX
tracks, RSS feeds and the parts inside a Word
document. A file saved with the plain .xml extension is usually data or
settings for a particular program.
Software
- Visual Studio Code (Windows, macOS, Linux)
- Notepad++ (Windows)
- Oxygen XML Editor (Windows, macOS, Linux)
- Firefox and other web browsers, which show XML as a tree
- libxml2 and its
xmllinttool (Windows, macOS, Linux) - Microsoft Excel, which can import XML data as a table
Structure
An XML file may open with a declaration giving the version and character encoding,
<?xml version="1.0" encoding="UTF-8"?>. Without one the encoding is
UTF-8, or UTF-16 when the file starts with a byte order mark.
The content is a single root element. An element is a start tag and an end tag around
its content, <name>…</name>, or one empty tag,
<name/>. Start tags carry attributes as
key="value" pairs. Elements nest strictly, with no overlap. Text may use
entity references such as & and <, and may
include comments, processing instructions and CDATA sections. Namespaces let one file
mix the elements of several vocabularies.
0Declaration version and encoding (optional)text…Document type or comments (optional)text…Root element every other element nests inside ittext