Validate an XML with a schema using xmllint on Ubuntu

Published on 06/04/2024

xmllint is a command line tool to work with XML files.

It permits a lot of operations such as formatting and validating XML against a schema.

You can install it in Ubuntu through the libxml2-utils package.

sudo apt install libxml2-utils

Format and beautify XML on standard output with

xmllint --format laptop-unformatted.xml

Validate an XML using a schema with

xmllint --schema laptop.xsd laptop.xml
  • Article is published under CC-BY 4.0
  • If not explicitly declared code snippets are published under MIT license