public static List<? extends Element> childElementList(Element element,Set<String> childElementNames){
  if (element == null)   return null;
  List<Element> elements=new LinkedList<Element>();
  if (childElementNames == null)   return elements;
  Node node=element.getFirstChild();
  if (node != null) {
    do {
      if (node.getNodeType() == Node.ELEMENT_NODE && childElementNames.contains(node.getNodeName())) {
        Element childElement=(Element)node;
        elements.add(childElement);
      }
    }
 while ((node=node.getNextSibling()) != null);
  }
  return elements;
}

public static List < ? extends Element > childElementList ( Element element , Set < String > childElementNames ) { if ( element == null ) return null ; List < Element > elements = new LinkedList < Element > ( ) ; if ( childElementNames == null ) return elements ; Node node = element . getFirstChild ( ) ; if ( node != null ) { do { if ( node . getNodeType ( ) == Node . ELEMENT_NODE && childElementNames . contains ( node . getNodeName ( ) ) ) { Element childElement = ( Element ) node ; elements . add ( childElement ) ; } } while ( ( node = node . getNextSibling ( ) ) != null ) ; } return elements ; }
return a list of element objects that have the given name and are immediate children of the given element ; if name is null , all child elements will be included .
