Extensible Markup Language
lastmod 2025-09-25created 2014-10-2530 edits
XML (Extensible Markup Language) is a general-purpose markup language recommended by the W3C for creating other special-purpose markup languages. XML is a simplified subset of SGML, but it can be applied to describe many kinds of data. XML was created mainly to overcome the limitations of HTML by making it easy to exchange data between different systems, especially systems connected to the Internet.
XML is a kind of markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. It is defined in the XML 1.0 Specification produced by the W3C, several other related specifications, and all free open standards.
The design goals of XML emphasize simplicity, generality, and usability over the Internet. XML is a textual data format that supports the world's languages through Unicode. Although the design of XML focuses on documents, it is widely used to represent arbitrary data structures, for example in web services.
Many APIs have been developed to help software developers process XML data. Several schema systems also exist to help define XML-based languages.
Header
OR:
Free C or C++ XML Parser Libraries
| Free C or C++ XML Parser Libraries |
| MSXML, eXpat, TinyXML, Xerces, Arabica, libxml2, libxml++, Xmlio, XmlLite, RapidXml, XMLParser library from Frank Vanden Berghen, PugiXML, libroxml |
Categories
- Simple API for XML (SAX)
- Document Object Model (DOM)
- Extensible Stylesheet Language (XSL)
- XSL Transformation (XSLT)
- XML Path Language (XPath)
- XSL Formatting Object (XSL-FO)
Libraries
- TinyXML
- Expat
- pugixml
- msxml
- StAX-XML - High-performance streaming XML parser for JavaScript/TypeScript
Python Libraries
- xmltodict
- xmlschema - An XML Schema validator and decoder
- lxml - Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
Relationships
- eXtensible Markup Language (XML)
- A language for defining data with structure, data, and presentation separated
- Document Type Definition (DTD) or XML Schema Definition (XSD)
- Data is represented as a tree-shaped XML document by the DTD or XSD
- eXtensible Stylesheet Language (XSL)
- Used for the final presentation (Description).
DOM vs SAX
- DOM
- Loads the whole XML document into memory first, then reads values.
- Because the whole XML document is loaded in memory, searching, modifying, and restructuring nodes is fast and easy.
- Intuitive and simpler to parse than SAX.
- Libraries - tinyxml2
- SAX
- Reads the XML document sequentially and fires events as nodes open and close.
- It does not load and parse the whole XML document into memory, so memory usage is low and simple reading is fast.
- It works by handling fired events and storing and using them in variables, so it is complex and modifying nodes is difficult.
- Harder to implement than DOM.
- Useful when handling very large XML.
- Libraries - expat
Terms
- QName (Qualified Name)
- Qualified names (QNames): a QName consists of an optional namespace prefix and a local name.
- e.g. <x:doc>
Pretty print XML
xmllint from libxml2
(On Debian based distributions install the libxml2-utils package)
xml_pp from the XML::Twig perl module
(On Debian based distributions install the xml-twig-tools package)
XMLStarlet
Tidy
Python's xml.dom.minidom
echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' |
python -c 'import sys, xml.dom.minidom; print(xml.dom.minidom.parseString(sys.stdin.read()).toprettyxml())'
saxon-lint
saxon-HE
echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' |
java -cp /usr/share/java/saxon/saxon9he.jar net.sf.saxon.Query \
-s:- -qs:/ '!indent=yes'
xidel
Favorite site
- WWW XML web page
- Wikipedia (en) description of XML
- [Recommended] XML tutorial (XML, DTD, SCHEMA, XPATH, XSTL) 1
- [Recommended] What is XML Schema (XSD) 2
Project
References
- Android:Layouts
- Android:ViewAnimation
- Boost:PropertyTree
- Computer Language
- Document Object Model
- Document type definition
- Expat
- Extensible Stylesheet Language
- GDM Format
- Godot:XMLParser
- Hierarchical Data Format
- Incremental DOM
- JavaScript:Example:XmlReader
- Markup Language
- MSXML
- MusicXML
- Nvidia-smi
- NvidiaSmi:XmlQueryParser
- Open XML Paper Specification
- Python:Libraries
- Python:xml.etree.ElementTree
- QName
- RELAX NG
- Shadow DOM
- Simple API for XML
- Standard Generalized Markup Language
- StAX-XML
- Tbag
- TinyXML
- Valgrind
- Virtual DOM
- Visidata
- XML Schema
- XmlSchemaClassGenerator
- Xmltodict