I'm using xmllint in a bash script to perform an xpath on some data. The xpath will not always match against the data, and this is ok. From xmllint documentation:
--xpath "XPath_expression"
Run an XPath expression given as argument and print the result. In case of a nodeset result, each node in the node set is serialized in full in the output. In case of an empty node set the "XPath set is
empty" result will be shown and an error exit code will be returned.
Is there anyway to disable/hide the output XPath set is empty
when xmllint doesn't find any matches?
xmllint ... 2>/dev/null
or merge the outputs (losing the distinction between stdout and stderr) likexlmlint ... 2>&1 | egrep -v 'XPath set is empty|possibly other msgs you don_t care about'
Good luck. – Interlining