01: // Copyright (c) 2003 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.kawa.xml;
05:
06: import gnu.lists.*;
07:
08: /** Used to implement a child:: step in a path expression. */
09:
10: public class ChildAxis extends TreeScanner {
11: public static ChildAxis make(NodePredicate type) {
12: ChildAxis axis = new ChildAxis();
13: axis.type = type;
14: return axis;
15: }
16:
17: public void scan(AbstractSequence seq, int ipos,
18: PositionConsumer out) {
19: int child = seq.firstChildPos(ipos, type);
20: while (child != 0) {
21: out.writePosition(seq, child);
22: child = seq.nextMatching(child, type, -1, false);
23: }
24: }
25: }
|