Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Vector;

import org.w3c.dom.Element;

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

public class Main {

    @SuppressWarnings("unchecked")
    public final static Vector subElementList(Element superEle, String subName) {
        Vector v = new Vector();
        NodeList list = superEle.getChildNodes();
        if (list == null) {
            return null;
        }

        for (int i = 0; i < list.getLength(); i++) {
            Node node = list.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                if (node.getNodeName().equals(subName)) {
                    v.add(node);
                }
            }
        }
        return v;
    }
}