Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.Vector;

import org.w3c.dom.Element;

import org.w3c.dom.NodeList;

public class Main {
    public static Vector<Element> getChildList(Element elem, String elementName) {
        if (elem == null)
            return null;
        NodeList nl = elem.getChildNodes();
        if (nl == null)
            return null;
        Vector<Element> retlist = new Vector<Element>(100);
        for (int n = 0; n < nl.getLength(); n++) {
            Element element = (Element) nl.item(n);
            if (elementName.equals(element.getTagName())) {
                retlist.addElement(element);
            }
        }
        if (retlist.size() == 0)
            return null;
        return retlist;
    }
}