**Extensible Markup Language - a document encoding markup language.**
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- XML (eXtensible Markup Language) stores data in a structured format -->
<document>
<!-- Each element is enclosed by a start tag and an end tag -->
<greeting>Hello, world!</greeting>
<!-- Elements can contain other elements (nesting) -->
<person>
<name>John Doe</name>
<age>30</age>
<location>New York</location>
</person>
<!-- Attributes can be added inside the opening tag -->
<book title="Learning XML" author="Jane Smith" year="2024">
<price>19.99</price>
</book>
<!-- Comments can be added for clarity, and they're ignored by XML parsers -->
<!-- XML is case-sensitive, so <name> and <Name> are different -->
<note>This is a simple example to show XML features.</note>
<!-- This example was sourced from ChatGPT, except this line which I added -->
</document>
```
XML (_Extensible Markup Language_) is a very widely-used well-supported markup language, upon which many many many document formats have been constructed. Office documents are typically XML-based. As are [[SVG]]s, RSS feeds, and hundreds of other types. XML is a form of [[Data Serialization]] and is hierarchical (tree-based).
# Components
All characters in an XML document are either _markup_ characters or _content_ characters. Markup strings are surrounded by `<` and `>` or `&` and `;`. Everything else is content.
## Tags
Tags are what's contained within the less than and greater than symbols. Tags contain a text-based identifier that informs how elements should be parsed. For example `<img>` identifies an the element represents an image.
## Elements
Elements are a a chunk of xml contained between matching opening and closing tags.
## Attributes
Attributes are name-value pairs inserted into the tag next to the tag identifier to supply supplemental data, such as the `src` attribute in an image tag: `<img src="whatever.jpg">`
## XML Declaration
XML documents begin with a declaration that describe how they are formatted (what standard they are using, what character encoding, etc).
# Example
```xml
<greeting>Hello there, <lie>friend</lie>.</greeting>
```
****
## Source
[XML - Wikipedia](https://en.wikipedia.org/wiki/XML)
## Related
- [[JSON]]
- [[YAML]]
- [[Data Serialization]]