xmllint: option to allow empty xpath set
Currently xmllint
prints an error and exits with code 10 if the nodeset produced by the XPath expression is empty:
echo '<a/>' | xmllint --xpath /b -
XPath set is empty
This makes error handling difficult in shell scripts (since code 10 is not unique to empty set, and capturing stdout
and stderr
separately in portable POSIX shell is problematic).
Would you be willing to consider an option to treat empty nodesets as expected (i.e. empty output and exit code 0)? Perhaps --xpath-allow-empty
or similar?
Thanks for considering, Kevin