sboag 01/10/25 09:44:15
Modified: java/src/org/apache/xpath/compiler XPathParser.java
Log:
Added fix for bug reported by Myriam for match="//x/a" patterns. On the
second "/" on "//", the parser wasn't swallowing the token, which caused
the "x" pattern to be ancestor instead of parent. If you don't have this fix,
it will cause 'a' to be matched when it has any ancestor that is 'x'.
This fix should be localized to only match patterns. The reason this probably
wasn't reported before, is because "//" at the head of a match pattern is
pretty useless, "x/a" being equivelent.
Revision Changes Path
1.17 +6 -0
xml-xalan/java/src/org/apache/xpath/compiler/XPathParser.java
Index: XPathParser.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/XPathParser.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- XPathParser.java 2001/06/12 19:16:30 1.16
+++ XPathParser.java 2001/10/25 16:44:15 1.17
@@ -2011,6 +2011,12 @@
if (lookahead('/', 1))
{
appendOp(4, OpCodes.MATCH_ANY_ANCESTOR);
+
+ // Added this to fix bug reported by Myriam for match="//x/a"
+ // patterns. If you don't do this, the 'x' step will think it's part
+ // of a '//' pattern, and so will cause 'a' to be matched when it has
+ // any ancestor that is 'x'.
+ nextToken();
}
else
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]