KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > kawa > xml > ChildAxis


1 // Copyright (c) 2003 Per M.A. Bothner.
2
// This is free software; for terms and warranty disclaimer see ./COPYING.
3

4 package gnu.kawa.xml;
5 import gnu.lists.*;
6
7 /** Used to implement a child:: step in a path expression. */
8
9 public class ChildAxis extends TreeScanner
10 {
11   public static ChildAxis make (NodePredicate type)
12   {
13     ChildAxis axis = new ChildAxis();
14     axis.type = type;
15     return axis;
16   }
17
18   public void scan (AbstractSequence seq, int ipos, PositionConsumer out)
19   {
20     int child = seq.firstChildPos(ipos, type);
21     while (child != 0)
22       {
23     out.writePosition(seq, child);
24         child = seq.nextMatching(child, type, -1, false);
25       }
26   }
27 }
28
Popular Tags