xmllint: Exit code 0 despite namespace error
I want to use xmllint
to validate XML files in a pre-commit hook. Unfortunately, namespace errors are reported but do still give an exit code of 0
:
$ echo '<f:a/>' | xmllint --noout -; echo $?
-:1: namespace error : Namespace prefix f on a is not defined
<f:a/>
^
0
I did not see any option in the man page that would change the exit code to non-zero if a namespace error occurs.
Please add such an option, or default to changing the exit code on namespace errors.
- OS: Debian GNU/Linux 12 (bookworm)
- Package: libxml2-utils 2.9.14+dfsg-1.3~deb12u1
$ xmllint --version
xmllint: using libxml version 20914
compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Unicode Regexps Automata Schemas Schematron Modules Debug Zlib Lzma
Related: https://mail.gnome.org/archives/xml/2021-June/msg00000.html
Edited by Christian Weiske