Re: [xml] xpath and structured errors

On Sunday 02 May 2004 17:39, Daniel Veillard wrote:

  Hum, could you keep this on the list, there is a problem, right, but
I really want archives.


Oops, I'm sorry, I'm using a mail client I'm not used to; I didn't notice Cc: 
was empty. The post follows. 

On Sunday 02 May 2004 16:21, Daniel Veillard wrote:

  xmlXPathCompile cannot report the run time error. And undefined
variables definitely sounds to me a run time error. So I think you're
looking in the wrong direction, but I may be wrong too.


Daniel, thanks for your quick response.
I admit I went through xpath.c code too hastily and my analysis might
have been rather misleading, confusing what happens at compile time and
what happens at evaluation time. However, the importand thing  that
XPATH_UNDEF_VARIABLE_ERROR isn't passed to structured error handler is
true nontheless.  The only occurrance of this error constant appears in
xmlXPathCompiledEval, at the line I mentioned before: 10297 where it is
assigned to ctxt->error where ctxt is a xmlXPathParserContextPtr (seeing
"Parser" in the struct name wrongly assumed this was used at

In XML::LibXML we call xmlXPathCompile for compilation and
xmlXPathCompiledEval for evaluation, so the problem probably there.
The relevant part of xmlXPathCompileEval reads:

#line 11055
    ctxt = xmlXPathCompParserContext(comp, ctx);

    if (ctxt->value == NULL) {
                "xmlXPathCompiledEval: evaluation failed\n");
        res = NULL;
    } else {
        res = valuePop(ctxt);

    /* snip ... */
#line 11079
    if (ctxt->error != XPATH_EXPRESSION_OK) {
        res = NULL;

Ok, I guess I'll have to invest some time to a gdb session to see what
happens down there really.

-- Petr

Attachment: pgpXl8Z5KA4W0.pgp
Description: signature

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