| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.tree.linked; |
| 9 |
|
| 10 |
import net.sf.saxon.pattern.NodeTest; |
| 11 |
import net.sf.saxon.type.Type; |
| 12 |
|
| 13 |
final class FollowingEnumeration extends TreeEnumeration { |
| 14 |
|
| 15 |
private NodeImpl root; |
| 16 |
|
| 17 |
public FollowingEnumeration(NodeImpl node, NodeTest nodeTest) { |
| 18 |
super(node, nodeTest); |
| 19 |
root = (NodeImpl)node.getRoot(); |
| 20 |
|
| 21 |
int type = node.getNodeKind(); |
| 22 |
if (type == Type.ATTRIBUTE || type == Type.NAMESPACE) { |
| 23 |
next = node.getParent().getNextInDocument(root); |
| 24 |
} else { |
| 25 |
do { |
| 26 |
next = node.getNextSibling(); |
| 27 |
if (next == null) { |
| 28 |
node = node.getParent(); |
| 29 |
} |
| 30 |
} while (next == null && node != null); |
| 31 |
} |
| 32 |
while (!conforms(next)) { |
| 33 |
step(); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
protected void step() { |
| 38 |
next = next.getNextInDocument(root); |
| 39 |
} |
| 40 |
|
| 41 |
} |
| 42 |
|