Esempio n. 1
0
 @Override
 public void visit(ERXML.Visitor visitor) {
   if (visitor.visit(this) && _children != null) {
     for (ERXML.Node node : _children) {
       node.visit(visitor);
     }
   }
 }
Esempio n. 2
0
    /**
     * Returns a set of descendent elements of this element that have the given name, or an empty
     * list if there aren't any.
     *
     * @param name the name of the descendent elements to look up
     * @return a set of descendents of this element that have the given name, or an empty set if
     *     there aren't any
     */
    public Set<ERXML.E> descendents(final String name) {
      final Set<ERXML.E> descendents = new LinkedHashSet<ERXML.E>();
      if (_children != null) {
        ERXML.Visitor visitor =
            new ERXML.Visitor() {
              public boolean visit(Item item) {
                if (item instanceof ERXML.E && ((ERXML.E) item)._name.equals(name)) {
                  descendents.add((ERXML.E) item);
                }
                return true;
              }
            };

        for (ERXML.Node node : _children) {
          node.visit(visitor);
        }
      }
      return descendents;
    }