[xml] xpath and structured errors



Hi Daniel, All,

I'm having troubles catching some XPath errors using structured error 
interface (via XML::LibXML perl module I'm working on). We're using 
xmlXPathCompile(path) to compile xpath expressions. While errors like Invalid 
expression when path="..." are reported fine, other errors like "Undefined 
variable" (XPATH_UNDEF_VARIABLE_ERROR) when e.g. path="$xyz" and $xyz is not 
registered, are not. Maybe it's just I'm doing something wrong. According to 
xpath.c, line 10297, the error code is assigned to ctxt->error, but it also 
seems that it gets discarded in xmlXPathCtxtCompile at
line 10978:

    if( pctxt->error != XPATH_EXPRESSION_OK )
    {
        xmlXPathFreeParserContext(pctxt);
        return (0);
    }

I'm not sure that this is intentional. Do I have to use my own 
xmlXPathParserContext and low-level API calls or some other way to get the 
error, or is it simply a bug that the hi-level xmlXPathCompile function 
doesn't also report the error via a generic structured error handler?

Thanks,
Petr

Attachment: pgprq426aPCxY.pgp
Description: signature



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