Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import org.w3c.dom.*;

import java.util.*;

public class Main {
    public static List<Element> getChildElements(Element elt, String name) {
        List<Element> list = new ArrayList<Element>();

        NodeList nodes = elt.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            Node child = nodes.item(i);
            if (child.getNodeType() == Node.ELEMENT_NODE)
                if (name.equals(child.getNodeName()))
                    list.add((Element) child);
        }
        return list;
    }
}