Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.*;

import org.w3c.dom.*;

public class Main {
    public static final List<Element> getChildElements(Element parent) {
        final List<Element> childElements = new ArrayList<Element>();

        final NodeList childNodes = parent.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); ++i) {
            final Node node = childNodes.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                childElements.add((Element) node);
            }
        }

        return childElements;
    }
}