public static void removeAllChildren(Node node){
  NodeList children=node.getChildNodes();
  for (int i=0, length=children.getLength(); i < length; i++) {
    node.removeChild(children.item(i));
  }
}

public static void removeAllChildren ( Node node ) { NodeList children = node . getChildNodes ( ) ; for ( int i = 0 , length = children . getLength ( ) ; i < length ; i ++ ) { node . removeChild ( children . item ( i ) ) ; } }
removes all children nodes from the specified node .
