sboag 01/02/10 11:56:06
Modified: java/src/org/apache/xpath/axes WalkerFactory.java
Log:
In indirect response to bug posted by "Thee Boon Hoo" <[EMAIL PROTECTED]>
02/07/2001 09:37 PM
"//table[1]" patterns would give one node
when they should have given 2, when applied to Boon Hoo's
source.
"//table[1]" is equivelent to
"/descendant-or-self::node()/table[1]",
and so must return the first table child
of each table-inst element.
An optimization was optimizing this to
"/descendant-or-self::table, which is
fine as long as indexing isn't used. Since
we can not tell until runtime if indexing
is being used, we have to turn of this
optimization for all predicated "//foo[xx]"
patterns.
Revision Changes Path
1.13 +7 -2
xml-xalan/java/src/org/apache/xpath/axes/WalkerFactory.java
Index: WalkerFactory.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/WalkerFactory.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- WalkerFactory.java 2001/01/04 08:02:51 1.12
+++ WalkerFactory.java 2001/02/10 19:56:06 1.13
@@ -232,7 +232,12 @@
// BIT_DESCENDANT_OR_SELF
// It's highly possible that we should have a seperate bit set for
// "//foo" patterns.
- else if (((BIT_DESCENDANT | BIT_DESCENDANT_OR_SELF | 0x00000001)
+ // For at least the time being, we can't optimize patterns like
+ // "//table[3]", because this has to be analyzed as
+ // "/descendant-or-self::node()/table[3]" in order for the indexes
+ // to work right.
+ else if (0 == (BIT_PREDICATE & analysis) &&
+ (((BIT_DESCENDANT | BIT_DESCENDANT_OR_SELF | 0x00000001)
== (analysis
& (BIT_DESCENDANT | BIT_DESCENDANT_OR_SELF | BITS_COUNT)))
||
((BIT_DESCENDANT_OR_SELF | BIT_SELF | 0x00000002)
@@ -249,7 +254,7 @@
BIT_ANY_DESCENDANT_FROM_ROOT | 0x00000003)
== (analysis
& (BIT_DESCENDANT_OR_SELF | BIT_ROOT | BIT_CHILD |
- BIT_NODETEST_ANY | BIT_ANY_DESCENDANT_FROM_ROOT |
BITS_COUNT)))
+ BIT_NODETEST_ANY | BIT_ANY_DESCENDANT_FROM_ROOT |
BITS_COUNT))))
)
{
if (DEBUG_ITERATOR_CREATION)