sboag 01/02/07 19:48:06
Modified: java/src/org/apache/xpath/axes PrecedingWalker.java
Log:
Fix for bug reported by Dave Haffner <[EMAIL PROTECTED]>
02/06/2001 04:03 AM
In nextSibling(), don't return null if isAncestorOfRootContext, instead
do next.getFirstChild().
Revision Changes Path
1.10 +44 -2
xml-xalan/java/src/org/apache/xpath/axes/PrecedingWalker.java
Index: PrecedingWalker.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/PrecedingWalker.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- PrecedingWalker.java 2001/01/03 10:16:59 1.9
+++ PrecedingWalker.java 2001/02/08 03:48:06 1.10
@@ -137,6 +137,17 @@
m_nextLevelAmount = 0;
+// if(null != next)
+// {
+// Node attrNode = next.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(next);
}
@@ -197,6 +208,17 @@
m_nextLevelAmount = (null == nextNode)
? 0 : (nextNode.hasChildNodes() ? 1 : 0);
+// if(null != nextNode)
+// {
+// Node attrNode = nextNode.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(nextNode);
}
@@ -214,12 +236,32 @@
return null;
Node next = m_currentNode.getNextSibling();
-
+
if ((null == next) || m_root.equals(next)
- || isAncestorOfRootContext(next))
+ /* || isAncestorOfRootContext(next) */)
return null;
+
+ if(isAncestorOfRootContext(next))
+ {
+ next = next.getFirstChild();
+
+ if ((null == next) || m_root.equals(next)
+ /* || isAncestorOfRootContext(next) */)
+ return null;
+ }
m_nextLevelAmount = (null == next) ? 0 : (next.hasChildNodes() ? 1 : 0);
+
+// if(null != next)
+// {
+// Node attrNode = next.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(next);
}