diff --git a/doc/xmllint.xml b/doc/xmllint.xml index 1901e89b..8bc66521 100644 --- a/doc/xmllint.xml +++ b/doc/xmllint.xml @@ -575,7 +575,7 @@ 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 unless the is set. + will be shown and exit code 11 will be returned.. This feature is EXPERIMENTAL. Implementation details can change without futher notice. @@ -947,6 +947,13 @@ + + 11 + + XPath result is empty + + + diff --git a/xmllint.c b/xmllint.c index 78a77d7a..9bf23f1f 100644 --- a/xmllint.c +++ b/xmllint.c @@ -90,17 +90,18 @@ #endif typedef enum { - XMLLINT_RETURN_OK = 0, /* No error */ - XMLLINT_ERR_UNCLASS = 1, /* Unclassified */ - XMLLINT_ERR_DTD = 2, /* Error in DTD */ - XMLLINT_ERR_VALID = 3, /* Validation error */ - XMLLINT_ERR_RDFILE = 4, /* CtxtReadFile error */ - XMLLINT_ERR_SCHEMACOMP = 5, /* Schema compilation */ - XMLLINT_ERR_OUT = 6, /* Error writing output */ - XMLLINT_ERR_SCHEMAPAT = 7, /* Error in schema pattern */ - XMLLINT_ERR_RDREGIS = 8, /* Error in Reader registration */ - XMLLINT_ERR_MEM = 9, /* Out of memory error */ - XMLLINT_ERR_XPATH = 10 /* XPath evaluation error */ + XMLLINT_RETURN_OK = 0, /* No error */ + XMLLINT_ERR_UNCLASS = 1, /* Unclassified */ + XMLLINT_ERR_DTD = 2, /* Error in DTD */ + XMLLINT_ERR_VALID = 3, /* Validation error */ + XMLLINT_ERR_RDFILE = 4, /* CtxtReadFile error */ + XMLLINT_ERR_SCHEMACOMP = 5, /* Schema compilation */ + XMLLINT_ERR_OUT = 6, /* Error writing output */ + XMLLINT_ERR_SCHEMAPAT = 7, /* Error in schema pattern */ + XMLLINT_ERR_RDREGIS = 8, /* Error in Reader registration */ + XMLLINT_ERR_MEM = 9, /* Out of memory error */ + XMLLINT_ERR_XPATH = 10, /* XPath evaluation error */ + XMLLINT_ERR_XPATH_EMPTY = 11 /* XPath result is empty */ } xmllintReturnCode; #ifdef LIBXML_DEBUG_ENABLED static int shell = 0; @@ -2031,6 +2032,7 @@ static void doXPathDump(xmlXPathObjectPtr cur) { int i; if ((cur->nodesetval == NULL) || (cur->nodesetval->nodeNr <= 0)) { + progresult = XMLLINT_ERR_XPATH_EMPTY; if (!quiet) { fprintf(stderr, "XPath set is empty\n"); }