Xmllint prints “warning” instead of "error", and leaves out "warning" for actual warnings
Originally discussed here: https://discourse.gnome.org/t/xmllint-prints-warning-but-shouldnt-it-be-error/19061.
If the input file does not exist:
$ xmllint foo.xml
warning: failed to load external entity "foo.xml"
That is an error. Even the exit code is non-zero.
$ echo $?
1
And its not just this particular example above. It seems that all errors are prefixed with warning.
$ XML_CATALOG_FILES=~/xsd_ler/mycatalog.xml \
xmllint --noout --nowarning \
--schema ~/xsd_ler/2.0_ler.xsd \
test.gml
warning: failed to load external entity "https://schemas.isotc211.org/19139/-/gmx/1.0/gmx.xsd"
/home/velle/xsd_ler/2.0_ler.xsd:19: element import: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}import': Failed to parse the XML resource 'https://schemas.isotc211.org/19139/-/gmx/1.0/gmx.xsd'.
WXS schema /home/velle/xsd_ler/2.0_ler.xsd failed to compile
And if I use the --nowarning
flag those lines prefixed with "warning" are still printed, while the output without any prefix are suppressed.
It seems to me that errors are given the wrong prefix when printed, and that the warnings are given no prefix.
Details below:
$ xmllint --version
xmllint: using libxml version 20913
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
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
Request:
I hope the solution will prefix warnings with "warning". This lets tools like lnav color format that line as a warning (typically yellow), where as debug output is not colored and error output is typically red.