public static boolean hasElementChild(Node node){
  NodeList nl=node.getChildNodes();
  Node child=null;
  int length=nl.getLength();
  for (int i=0; i < length; i++) {
    child=nl.item(i);
    if (child.getNodeType() == Node.ELEMENT_NODE) {
      return true;
    }
  }
  return false;
}

public static boolean hasElementChild ( Node node ) { NodeList nl = node . getChildNodes ( ) ; Node child = null ; int length = nl . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { child = nl . item ( i ) ; if ( child . getNodeType ( ) == Node . ELEMENT_NODE ) { return true ; } } return false ; }
checks if a node has a child of element type .
