Here you can find the source of removeAllChildNodes(Node node)
public static void removeAllChildNodes(Node node)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /**/* w ww . j av a2s . c o m*/ * Removes all child nodes from the given node. */ public static void removeAllChildNodes(Node node) { NodeList children = node.getChildNodes(); while (children.getLength() > 0) { node.removeChild(children.item(0)); } } }