Java tutorial
//package com.java2s; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /*** * Remove all children nodes * * @param node * node to remove children from * */ public static void removeAllChilden(final Node node) { if (node != null) { final NodeList childrens = node.getChildNodes(); for (int i = 0; i < childrens.getLength(); i++) { node.removeChild(childrens.item(i)); } } } }