Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Element;

import org.w3c.dom.NodeList;

public class Main {
    public static void removeAllChilds(Element parentElem) {
        NodeList children = parentElem.getChildNodes();

        if (children != null) {
            int listLength = children.getLength();
            for (int i = listLength - 1; i >= 0; i--) {
                Element child = (Element) children.item(i);
                parentElem.removeChild(child);
            }
        }
    }
}