mmidy       01/08/10 12:26:52

  Modified:    java/src/org/apache/xpath/axes WalkerFactory.java
  Log:
  Fix problem with duplicate nodes produced from a walking iterator
  
  Revision  Changes    Path
  1.21      +15 -5     
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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WalkerFactory.java        2001/08/08 03:55:51     1.20
  +++ WalkerFactory.java        2001/08/10 19:26:52     1.21
  @@ -1382,7 +1382,7 @@
     public static boolean walksNamespaces(int analysis)
     {
       return (0 != (analysis & BIT_NAMESPACE));
  -  }
  +  }  
   
     public static boolean walksChildren(int analysis)
     {
  @@ -1607,12 +1607,17 @@
       // can also cause duplicates to happen.  But select="axis*/@::*" 
patterns 
       // are OK, as are select="@foo/axis::*" patterns.
       // Unfortunately, we can't do this just via the analysis bits.
  -
  +    
       int stepType;
       int ops[] = compiler.getOpMap();
       int stepCount = 0;
       boolean foundWildAttribute = false;
       
  +    // Steps that can traverse anything other than down a 
  +    // subtree or that can produce duplicates when used in 
  +    // combonation are counted with this variable.
  +    int potentialDuplicateMakingStepCount = 0;
  +    
       while (OpCodes.ENDOP != (stepType = ops[stepOpCodePos]))
       {        
         stepCount++;
  @@ -1630,7 +1635,9 @@
           String localName = compiler.getStepLocalName(stepOpCodePos);
           // System.err.println("localName: "+localName);
           if(localName.equals("*"))
  -          foundWildAttribute = true;  
  +        {
  +          foundWildAttribute = true;
  +        }
           break;
         case OpCodes.FROM_FOLLOWING :
         case OpCodes.FROM_FOLLOWING_SIBLINGS :
  @@ -1646,10 +1653,13 @@
         case OpCodes.FROM_ANCESTORS_OR_SELF :      
         case OpCodes.MATCH_ANY_ANCESTOR :
         case OpCodes.MATCH_IMMEDIATE_ANCESTOR :
  -      case OpCodes.FROM_ROOT :
  -      case OpCodes.FROM_CHILDREN :
         case OpCodes.FROM_DESCENDANTS_OR_SELF :
         case OpCodes.FROM_DESCENDANTS :
  +        if(potentialDuplicateMakingStepCount > 0)
  +            return false;
  +        potentialDuplicateMakingStepCount++;
  +      case OpCodes.FROM_ROOT :
  +      case OpCodes.FROM_CHILDREN :
         case OpCodes.FROM_SELF :
           if(foundWildAttribute)
             return false;
  
  
  

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

Reply via email to