Complete Reference with Copy-Paste Examples
Part of The Direct Path to Linux Ubuntu
— free for all students and developers.
SOAP web services, enterprise Java (Jakarta EE), financial systems, government data exchange — XML remains dominant in enterprise.
XML handles mixed content — text with inline markup — that JSON and YAML cannot. DocBook, DITA, OpenDocument use XML.
XSLT transforms XML into HTML, PDF, other XML, or plain text — a powerful pipeline for document processing without programming.
XSD schemas validate XML with rich type constraints, patterns, and occurrence rules — far more powerful than JSON Schema.
Run a XML program:
# Python (built-in): python3 xml_demo.py # ElementTree (no install) # pip install lxml # for XPath 1.0 + XSLT + validation # Validate XML: xmllint --noout file.xml # basic well-formedness xmllint --schema schema.xsd file.xml # XSD validation xmllint --dtdvalid file.dtd file.xml # DTD validation # Apply XSLT: xsltproc style.xsl input.xml > output.html # Pretty-print: xmllint --format file.xml # indent XML python3 -c "import sys; from xml.dom.minidom import parseString; print(parseString(sys.stdin.read()).toprettyxml())"