neilg       2002/08/14 09:02:22

  Modified:    java/src/org/apache/xerces/impl/xs/identity
                        XPathMatcher.java Selector.java
  Log:
  fix for bug 11152
  
  Revision  Changes    Path
  1.9       +11 -7     
xml-xerces/java/src/org/apache/xerces/impl/xs/identity/XPathMatcher.java
  
  Index: XPathMatcher.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/identity/XPathMatcher.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XPathMatcher.java 13 Aug 2002 22:32:44 -0000      1.8
  +++ XPathMatcher.java 14 Aug 2002 16:02:22 -0000      1.9
  @@ -195,13 +195,16 @@
       // Public methods
       //
   
  -    /** Returns true if XPath has been matched. */
  -    public boolean isMatched() {
  +    /** 
  +     * Returns value of first member of fMatched that
  +     * is nonzero.  
  +     */
  +    public int isMatched() {
           // xpath has been matched if any one of the members of the union have 
matched.
           for (int i=0; i < fLocationPaths.length; i++)
  -            if ((fMatched[i] & MATCHED) == MATCHED) return true;
  -        return false;
  -    } // isMatched():boolean
  +            if ((fMatched[i] & MATCHED) == MATCHED) return fMatched[i];
  +        return 0;
  +    } // isMatched():int
   
       // returns whether this XPathMatcher was matching a Selector
       public boolean getIsSelector() {
  @@ -318,7 +321,7 @@
               fStepIndexes[i].push(startStep);
   
               // try next xpath, if not matching
  -            if ((fMatched[i] & MATCHED) == MATCHED || fNoMatchDepth[i] > 0) {
  +            if ((fMatched[i] & MATCHED_DESCENDANT) == MATCHED || fNoMatchDepth[i] > 
0) {
                   fNoMatchDepth[i]++;
                   continue;
               }
  @@ -397,6 +400,7 @@
               }
               if (fCurrentStep[i] == steps.length) {
                   if(sawDescendant) {
  +                    fCurrentStep[i] = descendantStep;
                       fMatched[i] = MATCHED_DESCENDANT;
                   } else {
                       fMatched[i] = MATCHED;
  
  
  
  1.7       +5 -3      
xml-xerces/java/src/org/apache/xerces/impl/xs/identity/Selector.java
  
  Index: Selector.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/identity/Selector.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Selector.java     13 Aug 2002 22:32:44 -0000      1.6
  +++ Selector.java     14 Aug 2002 16:02:22 -0000      1.7
  @@ -230,7 +230,9 @@
               fElementDepth++;
   
               // activate the fields, if selector is matched
  -            if (fMatchedDepth == -1 && isMatched()) {
  +            int matched = isMatched();
  +            if ((fMatchedDepth == -1 && ((matched & MATCHED) == MATCHED)) ||
  +                    ((matched & MATCHED_DESCENDANT) == MATCHED_DESCENDANT)) {
                   fMatchedDepth = fElementDepth;
                   fFieldActivator.startValueScopeFor(fIdentityConstraint);
                   int count = fIdentityConstraint.getFieldCount();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to