[xml] Error with xmlXPathCompile?

Hi Daniel,

If I read the documentation correctly, xmlXPathCompile should NULL
when an error occured.  This seems not to work however.

The following program:

/*                        crash-test.c                     */

#include <stdio.h>
#include <libxml/xpath.h>

int main (int argc, char ** argv)
    xmlXPathCompExprPtr compExpr = NULL;

    if ((compExpr = xmlXPathCompile(BAD_CAST "//title[head")) == NULL)
        fprintf(stderr, "Error: failed to compile expression\n");
        exit (1);
    fprintf(stderr, "Since `//title[head' is incomplete "
                    "this code should not be reached.\n");
    return 0;
generates this output:

    [geertk tcwlinux1 test]$ ./crash-test 
    Error xpath.c:6626: Invalid predicate
    Since `//title[head' is incomplete this code should not be reached.

Apparently the error is the detected, but xmlXPathCompile does _not_
return NULL.  Is this the intended behaviour?


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