Carlos E. R. wrote:
On 2023-05-02 13:07, Per Jessen wrote:
Carlos E. R. wrote:
On 2023-05-02 08:22, Per Jessen wrote:
Carlos E. R. wrote:
On 2023-05-01 15:30, Per Jessen wrote:
xmllint your.xml.file
It just prints my file back.
Good. That means it found no problem in that file.
What does it do when there is a problem?
If you had introduced an error and tried it, you would have had an answer in seconds :-)
The answer is - it complains.
I mean, is it obvious to see? Don't I have to go up a kilometre of print to see it up there, out of sight?
Again, if you had tried it, you would have had an answer in seconds :-) xmllint - <<KKK <carlos> <elem1>text</elem1> </carlo> KKK per@janeway:~> xmllint klop.xml klop.xml:776: parser error : Opening and ending tag mismatch: interface line 774 and zone </zone> ^ klop.xml:777: parser error : Premature end of data in tag zone line 2 ^ "klop.xml" is a copy of external.xml from the firewalld config, with a minor typo in line 774.
I would expect to see just a message like "good" or "bad", a single line.
Well. Other people might expect a return code indicating failure or success. By default, xmllint prints the parsed tree. Add argument '--noout' if you don't want that.
With all that print, I can not put it in my CLI:
Telcontar:/etc/firewalld # firewall-cmd --check-config && firewall-offline-cmd --check-config && firewall-cmd --reload && tail -n 100 /var/log/firewalld | grep `date -u +"%Y-%m-%d-%H"` success WARNING: 'NoneType' object has no attribute 'check': None WARNING: 'NoneType' object has no attribute 'check': None success Telcontar:/etc/firewalld #
The above has got nothing to do with xmllint, but it sounds like it checks against an xml schema and finds an unwanted/undefined attribute. Hmm, maybe not - there is no schema specified in that file.
# xmllint zones/external.xml
just prints the file and I can't know where is the line that produces that warning.
xmllint in the basic invocation only checks for the XML being well-formed, i.e. syntactically correct. -- Per Jessen, Zürich (18.9°C) Member, openSUSE Heroes (2016 - present) We're hiring - https://en.opensuse.org/openSUSE:Heroes