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.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static Vector getChildrenElementsByTag(Node node, String name) {
        Vector result = new Vector();
        NodeList nl = node.getChildNodes();
        for (int i = 0; i < nl.getLength(); i++)
            if (nl.item(i) instanceof Element
                    && (((Element) nl.item(i)).getTagName().equals(name) || name == null)) {
                result.add(nl.item(i));
                //System.out.println(nl.item(i).toString());
                //System.out.println(((Element)nl.item(i)).getAttribute("className"));
                //System.out.println(((Element)nl.item(i)).getTagName());
            }
        return result;
    }
}