- // Stuff below here is Adam's hack //////////////////////////////////////////////////////////////////////////////
-
- boolean done = false;
- public static class Pull extends XML {
- public Pull(Reader in) { this.in = in; off = len = 0; line = col = 1; clear(); }
- StringBuffer sb = new StringBuffer();
- Element pending = null;
- boolean emptytag = true;
- public int level = 0;
- public final void startElement(Element e) throws Exn { emptytag = false; level++; pending = e; }
- public final void endElement(Element e) throws Exn, IOException { emptytag=pending!=null; level--; }
- public final void whitespace(char[] ch, int start, int length) throws Exn, IOException { }
- public final void characters(char[] ch, int start, int length) throws Exn, IOException {
- emptytag=false; sb.append(ch,start,length);}
- public Object read() throws Exn, IOException {
- while(!done) {
- if (pending != null) { Element ret = pending; pending = null; ret.level = level-(emptytag?0:1); return ret; }
- if (sb.length() > 0) { String ret = sb.toString(); sb.setLength(0); return ret; }
- if (!buffer(1)) {
- if (done) return null;
- throw new Exn("reached eof without closing <"+current.qName+"> element", Exn.WFC, getLine(), getCol());
- }
- if (buf[off] == '<') readTag(); else readChars(!done);
- }
- return null;
- }
- }
-
-
- // Stuff above here is Adam's hack //////////////////////////////////////////////////////////////////////////////
-