Android XML Node Child Remove removeDirectChildren(Node parent)

Here you can find the source of removeDirectChildren(Node parent)

Description

remove Direct Children

Declaration

public static void removeDirectChildren(Node parent) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static void removeDirectChildren(Node parent) {
        NodeList childNodes = parent.getChildNodes();
        while (childNodes.getLength() > 0) {
            parent.removeChild(childNodes.item(0));
        }//from   w  w w. ja  va 2s.c o m
    }
}