}
public static class FromXML extends Node.Stream {
- private final XML.Pull xml;
- private XML.Element parent = null;
- private XML.Element e;
+ private final XML.Stream xml;
+ private XML.Elem parent = null;
+ private XML.Elem e;
private int currentdelta = 0;
- public FromXML(Reader r) { this.xml = new XML.Pull(r); }
+ public FromXML(Reader r) { this.xml = new XML.Stream(r); }
protected boolean _read(Node n) { try {
- Object ret = xml.read();
+ Object ret = xml.next();
if (ret == null) return false;
if (ret instanceof String) {
n.cdata = (String)ret;
- n.delta = xml.level - currentdelta;
- currentdelta = xml.level;
+ n.delta = xml.getDepth() - currentdelta;
+ currentdelta = xml.getDepth();
return true;
}
- XML.Element e = (XML.Element)ret;
+ XML.Elem e = (XML.Elem)ret;
n.name = e.getLocalName();
n.uri = e.getUri();
- n.numattrs = e.getAttrLen();
- n.delta = e.level - currentdelta;
- currentdelta = e.level;
+ n.numattrs = e.getAttributes().attrSize();
+ n.delta = xml.getDepth() - currentdelta;
+ currentdelta = xml.getDepth();
if (n.attrs == null || n.attrs.length < n.numattrs*2) n.attrs = new String[n.numattrs*4];
- for(int i=0; i<n.numattrs; i++) { n.attrs[i*2] = e.getAttrKey(i); n.attrs[i*2+1] = e.getAttrVal(i); }
+ for(int i=0; i<n.numattrs; i++) {
+ n.attrs[i*2] = e.getAttributes().getKey(i);
+ n.attrs[i*2+1] = e.getAttributes().getVal(i);
+ }
return true;
} catch (Exception e) { throw new RuntimeException(e); } }
}