summaryrefslogtreecommitdiff
path: root/xmllint.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2022-10-19 02:47:30 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2022-10-19 02:51:14 +0200
commite85f9b98a5389c69167176ae6600091e719ec38f (patch)
treeafec3a8ce263f1b28fe0d58ac72888b44964a8eb /xmllint.c
parent530938b4870192d51fd0f01e564c12acc0f7acac (diff)
downloadlibxml2-e85f9b98a5389c69167176ae6600091e719ec38f.tar.gz
xmllint: Improve handling of empty XPath node sets
Don't return an error if the result is an empty node set. Suppress the "XPath set is empty" message in quiet mode. Fixes #180.
Diffstat (limited to 'xmllint.c')
-rw-r--r--xmllint.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmllint.c b/xmllint.c
index 02042382..e283b80d 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -2022,8 +2022,9 @@ static void doXPathDump(xmlXPathObjectPtr cur) {
xmlOutputBufferPtr buf;
if ((cur->nodesetval == NULL) || (cur->nodesetval->nodeNr <= 0)) {
- fprintf(stderr, "XPath set is empty\n");
- progresult = XMLLINT_ERR_XPATH;
+ if (!quiet) {
+ fprintf(stderr, "XPath set is empty\n");
+ }
break;
}
buf = xmlOutputBufferCreateFile(stdout, NULL);