Re: [xml] Problem with XPath Expression?
- From: Daniel Veillard <veillard redhat com>
- To: Yuuichi Teranishi <teranisi gohome org>
- Cc: xml gnome org
- Subject: Re: [xml] Problem with XPath Expression?
- Date: Sun, 22 Apr 2001 04:39:41 -0400
On Mon, Apr 09, 2001 at 04:07:01PM +0900, Yuuichi Teranishi wrote:
Hello,
I think following should cause an syntax error.
% testXPath --expr "false() ABRACADABRA true()"
But it ends normally and returns a value at the error point.
=> Object is a Boolean : false
I don't know the detail of the code,
but following patch (for latest CVS) seems to fix the problem.
Well the patch provided is not really the right way to catch this.
----------------- xmlXPathEval( -----------
if (ctxt->value == NULL) {
xmlGenericError(xmlGenericErrorContext,
"xmlXPathEval: evaluation failed\n");
res = NULL;
} else if (*ctxt->cur != 0) {
xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR);
res = NULL;
} else {
res = valuePop(ctxt);
}
----------------
is a far better way IMHO.
orchis:~/XML -> testXPath --expr "false() ABRACADABRA true()"
Error xpath.c:7597: Invalid expression
false() ABRACADABRA true()
^
Object is empty (NULL)
orchis:~/XML ->
I fixed xmlXPathCompile to detect it.
Daniel
--
Daniel Veillard | Red Hat Network http://redhat.com/products/network/
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]