Re: [xml] handling xpath error - libxml



Hi,

Senthil Nathan wrote:
I would like to how to handle the xpath error gracefully when I use the
libxml api,
xmlXPathEvalExpression(path, xpathCtx).

If I pass a invalid path string to evaluate on the "xpathCtx", it throws the
error as below and stops there.
But I would like to handle that error gracefully and log it accordingly and
proceed with my application.

What is the reason why you cannot just continue after this error? Just call
xmlXPathEvalExpression() again (with a working expression) and everything
should be fine.


So, could anyone give me ideas on doing the same? Or is it possible to check
the xpath expr is valid or not even before
calling the libxml api.

You can compile the expression.

Stefan



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