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