Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.LinkedList;
import java.util.List;

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

public class Main {
    public static List<Element> getChildsWithName(Element root, String name) {
        NodeList childNodes = root.getElementsByTagName(name);
        List<Element> elementList = new LinkedList<Element>();
        for (int i = 0; i < childNodes.getLength(); ++i) {
            elementList.add((Element) childNodes.item(i));
        }
        return elementList;
    }
}