Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;

import org.w3c.dom.Node;

public class Main {
    /**
     * Returns a list of all child nodes
     * @param node
     * @return
     */
    public static ArrayList<Node> getAllChildren(Node node) {
        ArrayList<Node> list = new ArrayList<Node>();
        if (node == null)
            return list;

        for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
            list.add(child);
        }

        return list;
    }
}