Here you can find the source of removeChildren(Node parent)
public static void removeChildren(Node parent)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Node; public class Main { public static void removeChildren(Node parent) { for (;;) { Node n = parent.getFirstChild(); if (n == null) { break; }//from ww w . j ava2 s . co m parent.removeChild(n); } } }