Re: [xml] xpath and structured errors



On Sat, May 01, 2004 at 10:39:50PM +0200, Petr Pajas wrote:
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 

  Well the first ones are compilation errors. And the second ones are 
errors at runtime, 

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 

  that's freeing of the parsing context. I don't think it relates to the
evaluation errors. The parsing context doesn't have to be kept around
for evaluations.

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?

  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

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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