public int hashCode() { int hash = mName.hashCode(); hash = addHash(getNamespaces(), hash); hash = addHash(getAttributes(), hash); return hash; } }
protected StartElement createStartElement(QName name, Iterator<?> attr, Iterator<?> ns, NamespaceContext ctxt) { return StartElementEventImpl.construct(mLocation, name, attr, ns, ctxt); } }
public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (!(o instanceof StartElement)) return false; StartElement other = (StartElement) o; // First things first: names must match if (mName.equals(other.getName())) { /* Rest is much trickier. I guess the easiest way is to * just blindly iterate through ns decls and attributes. * The main issue is whether ordering should matter; it will, * if just iterating. Would need to sort to get canonical * comparison. */ if (iteratedEquals(getNamespaces(), other.getNamespaces())) { return iteratedEquals(getAttributes(), other.getAttributes()); } } return false; }
public static StartElementEventImpl construct(Location loc, QName name, Iterator attrIt, Iterator nsDeclIt, NamespaceContext nsCtxt) { ArrayList attrs; if (attrIt == null || !attrIt.hasNext()) { attrs = null; } else { attrs = new ArrayList(); do { // Cast is only done for early catching of incorrect types attrs.add((Attribute) attrIt.next()); } while (attrIt.hasNext()); } ArrayList nsDecls; if (nsDeclIt == null || !nsDeclIt.hasNext()) { nsDecls = null; } else { nsDecls = new ArrayList(); do { nsDecls.add((Namespace) nsDeclIt.next()); // cast to catch type problems early } while (nsDeclIt.hasNext()); } return new StartElementEventImpl(loc, name, attrs, nsDecls, nsCtxt); }
return StartElementEventImpl.construct (loc, r.getName(), ((attrs == null) ? EmptyIterator.getInstance() : attrs.iterator()),