You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@apache.org on 2001/02/08 04:45:45 UTC

cvs commit: xml-xalan/java/src/org/apache/xpath/axes FollowingWalker.java

sboag       01/02/07 19:45:44

  Modified:    java/src/org/apache/xpath/axes FollowingWalker.java
  Log:
  Fix for bug reported by Dave Haffner <da...@xmls.com>
  02/06/2001 04:03 AM
  In parentNode(), don't screen out nextAncestor, since the parent
  is never actually returned.  This sets things up correctly for firstChild
  and nextSibling.
  
  Revision  Changes    Path
  1.6       +54 -21    xml-xalan/java/src/org/apache/xpath/axes/FollowingWalker.java
  
  Index: FollowingWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/FollowingWalker.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FollowingWalker.java	2000/12/17 17:40:01	1.5
  +++ FollowingWalker.java	2001/02/08 03:45:43	1.6
  @@ -134,32 +134,43 @@
     {
   
       Node n;
  -    Node nextAncestor = (null != m_currentAncestor)
  -                        ? m_currentAncestor.getParentNode() : null;
  +//    Node nextAncestor = (null != m_currentAncestor)
  +//                        ? m_currentAncestor.getParentNode() : null;
       Node nextParent = m_currentNode.getParentNode();
   
  -    if (nextParent == nextAncestor)
  -    {
  -      n = null;
  -
  -      Node ancestor = m_currentAncestor;
  -
  -      while ((null != ancestor)
  -             && (null != (ancestor = (Node) ancestor.getParentNode())))
  -      {
  -        n = ancestor.getNextSibling();
  -
  -        if ((null != n) || (null == ancestor))
  -          break;
  -      }
  -
  -      m_currentAncestor = ancestor;
  -    }
  -    else
  +//    if (nextParent == nextAncestor)
  +//    {
  +//      n = null;
  +//
  +//      Node ancestor = m_currentAncestor;
  +//
  +//      while ((null != ancestor)
  +//             && (null != (ancestor = (Node) ancestor.getParentNode())))
  +//      {
  +//        n = ancestor.getNextSibling();
  +//
  +//        if ((null != n) || (null == ancestor))
  +//          break;
  +//      }
  +//
  +//      m_currentAncestor = ancestor;
  +//    }
  +//    else
       {
         n = nextParent;
       }
   
  +//    if(null != n)
  +//    {
  +//      Node attrNode = n.getAttributes().getNamedItem("id");
  +//      if(null != attrNode)
  +//        System.out.println("parentNode: "+attrNode.getNodeValue());
  +//      else
  +//        System.out.println("parentNode: no id value");
  +//    }
  +//    else
  +//      System.out.println("parentNode: null");
  +
       return setCurrentIfNotNull(n);
     }
   
  @@ -196,7 +207,18 @@
       }
   
       m_nextLevelAmount = (null == n) ? 0 : (n.hasChildNodes() ? 1 : 0);
  -
  +    
  +//    if(null != n)
  +//    {
  +//      Node attrNode = n.getAttributes().getNamedItem("id");
  +//      if(null != attrNode)
  +//        System.out.println("firstChild: "+attrNode.getNodeValue());
  +//      else
  +//        System.out.println("firstChild: no id value");
  +//    }
  +//    else
  +//      System.out.println("firstChild: null");
  +      
       return setCurrentIfNotNull(n);
     }
   
  @@ -214,6 +236,17 @@
       n = m_currentNode.getNextSibling();
   
       m_nextLevelAmount = (null == n) ? 0 : (n.hasChildNodes() ? 1 : 0);
  +
  +//    if(null != n)
  +//    {
  +//      Node attrNode = n.getAttributes().getNamedItem("id");
  +//      if(null != attrNode)
  +//        System.out.println("nextSibling: "+attrNode.getNodeValue());
  +//      else
  +//        System.out.println("nextSibling: no id value");
  +//    }
  +//    else
  +//      System.out.println("nextSibling: null");
   
       return setCurrentIfNotNull(n);
     }