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 an attribute:: step in a path expression. */
09:
10: public class AttributeAxis extends TreeScanner {
11: public static AttributeAxis make(NodePredicate type) {
12: AttributeAxis axis = new AttributeAxis();
13: axis.type = type;
14: return axis;
15: }
16:
17: public void scan(AbstractSequence seq, int ipos,
18: PositionConsumer out) {
19: ipos = seq.firstAttributePos(ipos);
20: while (ipos != 0) {
21: if (type.isInstancePos(seq, ipos))
22: out.writePosition(seq, ipos);
23: else if (seq.getNextKind(ipos) != Sequence.ATTRIBUTE_VALUE)
24: break;
25: ipos = seq.nextPos(ipos);
26: }
27: }
28: }
|