Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {

    public static Node removeChildren(Node parentNode) {
        if (parentNode != null) {
            NodeList list = parentNode.getChildNodes();
            if (list != null) {
                for (int i = 0; i < list.getLength(); i++) {
                    Node node = list.item(i);
                    if (node != null) {
                        parentNode.removeChild(node);
                    }
                }
            }
        }
        return parentNode;
    }
}