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;

public class Main {
    public static Vector<Element> getChildElemsByName(String name, Node parent) {
        Vector<Element> v = new Vector<Element>();
        Element E = null;
        for (Node childNode = parent.getFirstChild(); childNode != null; childNode = childNode.getNextSibling()) {
            if (childNode.getNodeType() == Node.ELEMENT_NODE) {
                if (childNode.getNodeName() == name) {
                    E = (Element) childNode;
                    v.add(E);
                }
            }
        }
        return v;
    }
}