[xml] one more xpath patch
- From: Aleksey Sanin <aleksey aleksey com>
- To: xml gnome org
- Subject: [xml] one more xpath patch
- Date: Fri, 31 May 2002 12:43:44 -0700
Hi, Daniel!!./ap
I have one more xpath patch but I would like to have you review
before commiting it. Consider the following xpath expressions:
string(self::node())
string()
According to
http://www.w3.org/TR/xpath#node-tests both these
expressions should be totaly equvivalent:
"A node test
node()
is true for any node of any type whatsoever."
However, if the current node is namespace then LibXML returns
an empty string for the first _expression_ and correct value (href) for
the second one. I found that the same problem happens when
node is an attribute. The suggested patch removes all checks
for the "::node()" function (type == NODE_TYPE_NODE) as it is
required by xpath spec. Please let me know your opinion on this.
Aleksey.
Index: xpath.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/xpath.c,v
retrieving revision 1.193
diff -c -r1.193 xpath.c
*** xpath.c 31 May 2002 04:24:13 -0000 1.193
--- xpath.c 31 May 2002 19:37:19 -0000
***************
*** 8732,8745 ****
STRANGE return(t);
case NODE_TEST_TYPE:
if ((cur->type == type) ||
! ((type == NODE_TYPE_NODE) &&
! ((cur->type == XML_DOCUMENT_NODE) ||
! (cur->type == XML_HTML_DOCUMENT_NODE) ||
! (cur->type == XML_ELEMENT_NODE) ||
! (cur->type == XML_PI_NODE) ||
! (cur->type == XML_COMMENT_NODE) ||
! (cur->type == XML_CDATA_SECTION_NODE) ||
! (cur->type == XML_TEXT_NODE))) ||
((type == NODE_TYPE_TEXT) &&
(cur->type == XML_CDATA_SECTION_NODE))) {
#ifdef DEBUG_STEP
--- 8732,8738 ----
STRANGE return(t);
case NODE_TEST_TYPE:
if ((cur->type == type) ||
! (type == NODE_TYPE_NODE) ||
((type == NODE_TYPE_TEXT) &&
(cur->type == XML_CDATA_SECTION_NODE))) {
#ifdef DEBUG_STEP
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]