remove Direct XML Children from Node - Android XML

Android examples for XML:XML Node

Description

remove Direct XML Children from Node

Demo 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));
        }/*w  ww .j  a v a  2 s  .  co  m*/
    }
}

Related Tutorials