final Set<ERXML.Item> shouldVisit = new HashSet<ERXML.Item>();
shouldVisit.add(doc);
shouldVisit.addAll(doc.children());
final Set<ERXML.Item> visited = new HashSet<ERXML.Item>();
doc.visit(new Visitor() {
public boolean visit(Item item) {
visited.add(item);
return true;
}
});