public Collection<XMLElement> consumeChildElements(Interpreter<Boolean> interpreter) throws UnableToCompleteException {
  List<XMLElement> elements=new ArrayList<XMLElement>();
  List<Node> doomed=new ArrayList<Node>();
  NodeList childNodes=elem.getChildNodes();
  for (int i=0; i < childNodes.getLength(); ++i) {
    Node childNode=childNodes.item(i);
    if (childNode.getNodeType() == Node.ELEMENT_NODE) {
      XMLElement childElement=provider.get((Element)childNode);
      if (interpreter.interpretElement(childElement)) {
        elements.add(childElement);
        doomed.add(childNode);
      }
    }
  }
  for (  Node n : doomed) {
    elem.removeChild(n);
  }
  return elements;
}

public Collection < XMLElement > consumeChildElements ( Interpreter < Boolean > interpreter ) throws UnableToCompleteException { List < XMLElement > elements = new ArrayList < XMLElement > ( ) ; List < Node > doomed = new ArrayList < Node > ( ) ; NodeList childNodes = elem . getChildNodes ( ) ; for ( int i = 0 ; i < childNodes . getLength ( ) ; ++ i ) { Node childNode = childNodes . item ( i ) ; if ( childNode . getNodeType ( ) == Node . ELEMENT_NODE ) { XMLElement childElement = provider . get ( ( Element ) childNode ) ; if ( interpreter . interpretElement ( childElement ) ) { elements . add ( childElement ) ; doomed . add ( childNode ) ; } } } for ( Node n : doomed ) { elem . removeChild ( n ) ; } return elements ; }
consumes and returns all child elements selected by the interpreter . note that text nodes are not elements , and so are not presented for interpretation , and are not consumed .
