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.LinkedList;
import java.util.List;

public class Main {
    public static List<Element> getElementsByTagName(Element element, String name) {

        List<Element> elements = new LinkedList<Element>();
        NodeList nodeList = element.getElementsByTagName(name);

        for (int i = 0; i < nodeList.getLength(); i++) {
            elements.add((Element) nodeList.item(i));
        }

        return elements;
    }
}