[libxml2] xmllint: Improve handling of empty XPath node sets



commit e85f9b98a5389c69167176ae6600091e719ec38f
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Wed Oct 19 02:47:30 2022 +0200

    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.

 xmllint.c | 5 +++--
 1 file 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]