public static Element find(Node parent,String name){
  NodeList list=parent.getChildNodes();
  for (int i=0; i < list.getLength(); i++) {
    Node n=list.item(i);
    if (n instanceof Element) {
      Element e=(Element)n;
      if (name.equals(e.getAttribute("id"))) {
        return e;
      }
    }
    Element r=find(n,name);
    if (r != null) {
      return r;
    }
  }
  return null;
}

public static Element find ( Node parent , String name ) { NodeList list = parent . getChildNodes ( ) ; for ( int i = 0 ; i < list . getLength ( ) ; i ++ ) { Node n = list . item ( i ) ; if ( n instanceof Element ) { Element e = ( Element ) n ; if ( name . equals ( e . getAttribute ( "id" ) ) ) { return e ; } } Element r = find ( n , name ) ; if ( r != null ) { return r ; } } return null ; }
find an element by its " id " attribute ; null if no element is found .
