Hundreds of other document formats, including HTML (for rendering web pages) and SVG (for rendering scalable graphics), take inspiration from the XML syntax.
How is data encoded in XML?
XML documents consist of content surrounded by markup, generally in the form of tags.
- Tag: constructs that begin with < and end with >. They can be opening tags <...> or closing tags </...>. Some tags are self-closing <.../>.
- Attributes: key-value pairs that supplement tags. They are placed within the opening tag and use = as the separator.
- Content: any text that is not markup and is used to refer to its literal value. Content generally occurs in attribute values or within the opening and closing tag.
- Element: a logical block in XML. An element could consist of content between an opening and closing tag or just a self-closing tag.
XML can describe nested, and complex data structures since elements can contain other elements in the content portion. XML shines where predefined schemas, data types, and namespaces allow for a very standardized form of data transmission.
What are the shortcomings of XML?
One of the main shortcomings of XML is that it is exceedingly verbose and very redundant. JSON and YAML are much simpler alternatives.