Utilities
Check XML documents and optional XSD validity
xmllint-check is an XML well-formedness and optional local-XSD validation node.
overview
What xmllint-check does
Check XML files for well-formedness, and optionally validate them against an XSD schema, with libxml2 xmllint. Returns one JSON line per file with native error messages. No network access and no entity expansion.
Recursively check XML files with Debian libxml2-utils 2.9.14+dfsg-1.3~deb12u6. Return path-ordered JSON Lines containing file, native exit_code, well_formed and up to 200 native error lines. Supplying schema adds valid for validation against the local XSD.
Accept 1 to 200 .xml files, at most 50 MiB and 2000 entries. The optional .xsd path must stay inside the supplied folder. Malformed or invalid XML is result data; an unparsable schema, invalid schema path or unexpected native failure fails without output. --nonet prevents network fetching; external DTDs are not loaded and entities are not expanded.
Packaged version: 2.9.14. Upstream license: MIT.
source github.com/GNOME/libxml2/tree/7846b0a677f8d3ce72486125fa281e92ac9970e8
use cases
Where xmllint-check fits
Separate syntax and schema errors
Distinguish well-formedness from optional XSD validity in each row.
Validate a folder of documents
Apply one supplied local schema to every discovered XML file.
Keep native error messages
Receive bounded xmllint messages with each source path.
reference
xmllint-check inputs and flags
| Name | Type | Flag | Description |
|---|---|---|---|
| source | FOLDER | --source | Folder with 1–200 .xml files (searched recursively) and an optional .xsd schema; maximum 50 MiB. |
| schema | STRING | --schema | Optional path of an .xsd file inside the source folder to validate every document against. |
Showing key inputs. xmllint-check exposes 2 inputs in total.
example
Run xmllint-check
python3 /app/run.py --source ./source --schema order.xsd ./outputguidance
Choosing xmllint-check
Use xmllint-check to distinguish malformed XML from a schema-invalid document. It exposes no DTD validation, XInclude, XPath or reformatting. XSD validation does not support entity references and can report a native internal validation error for documents using them. This is an XML job; AJV validates JSON Schema.
faq
xmllint-check questions
related
More Utilities tools
browser-fetch
Headless Chromium render: requested URL, final URL, status, and title next to the page.
cewl
Spider a URL and return a wordlist for password crackers.
csvkit
SQL on one CSV. The table name is the file stem.
dnsgen
Wordlist and mined-word subdomain permutation.
duckdb
In-process SQL on CSV, JSON, and Parquet. No server.
edge-tts
Microsoft Edge neural speech from text or a script file. No API key.
Run xmllint-check yourself
The saved XSD fixture verifier confirmed good.xml valid, invalid.xml well formed but schema-invalid, and broken.xml malformed with an opening/ending-tag mismatch. The complete native JSON Lines report was not retained. The command shows the container entrypoint with example paths.
Facts on this page come from the live Trickest tool library.