Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * JFox - The most lightweight Java EE Application Server!
 * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
 *
 * JFox is licenced and re-distributable under GNU LGPL.
 */

import java.util.ArrayList;

import java.util.List;

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

public class Main {
    public static List<Element> getChildElements(Element parentElement) {
        NodeList nodeList = parentElement.getChildNodes();
        List<Element> childElements = new ArrayList<Element>(nodeList.getLength());
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node childNode = nodeList.item(0);
            if (childNode.getNodeType() == Node.ELEMENT_NODE) {
                childElements.add((Element) childNode);
            }
        }
        return childElements;
    }
}