Here you can find the source of removeChildren(Node parent)
public static void removeChildren(Node parent)
//package com.java2s; import org.w3c.dom.Node; public class Main { public static void removeChildren(Node parent) { Node child = parent.getFirstChild(); while (child != null) { Node next = child.getNextSibling(); parent.removeChild(child);/*w ww .ja v a 2 s . c o m*/ child = next; } } }