You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@locus.apache.org on 2000/11/01 02:26:31 UTC
cvs commit: xml-xerces/c/src/dom NodeIteratorImpl.cpp
andyh 00/10/31 17:26:31
Modified: c/src/dom NodeIteratorImpl.cpp
Log:
DOM NodeIterator bug fix - iterators would sometimes continue beyond
their starting (root) node. Fix from Tinny Ng.
Revision Changes Path
1.11 +23 -18 xml-xerces/c/src/dom/NodeIteratorImpl.cpp
Index: NodeIteratorImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/NodeIteratorImpl.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- NodeIteratorImpl.cpp 2000/07/17 23:00:16 1.10
+++ NodeIteratorImpl.cpp 2000/11/01 01:26:30 1.11
@@ -56,6 +56,10 @@
/*
* $Log: NodeIteratorImpl.cpp,v $
+ * Revision 1.11 2000/11/01 01:26:30 andyh
+ * DOM NodeIterator bug fix - iterators would sometimes continue beyond
+ * their starting (root) node. Fix from Tinny Ng.
+ *
* Revision 1.10 2000/07/17 23:00:16 jpolast
* bug fix for SHOW_ELEMENT flag incorrectly being retreived.
* contributed by Grace Yan and Joe Kesselman.
@@ -339,26 +343,27 @@
return result;
}
}
-
+
// if hasSibling, return sibling
- result = node.getNextSibling();
- if (! result.isNull()) return result;
-
-
- // return parent's 1st sibling.
- DOM_Node parent = node.getParentNode();
- while (!parent.isNull() && parent != fRoot) {
- result = parent.getNextSibling();
- if (!result.isNull()) {
- return result;
- } else {
- parent = parent.getParentNode();
- }
-
- } // while (parent != null && parent != fRoot) {
-
+ if (node != fRoot) {
+ result = node.getNextSibling();
+ if (! result.isNull()) return result;
+
+
+ // return parent's 1st sibling.
+ DOM_Node parent = node.getParentNode();
+ while (!parent.isNull() && parent != fRoot) {
+ result = parent.getNextSibling();
+ if (!result.isNull()) {
+ return result;
+ } else {
+ parent = parent.getParentNode();
+ }
+
+ } // while (parent != null && parent != fRoot) {
+ }
// end of list, return null
- DOM_Node aNull;
+ DOM_Node aNull;
return aNull;
}