Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class Main {
    /**
     * 
     * @param nodelist
     * @param name
     * @return
     */
    public static Element getXMLElement(final NodeList nodelist, final String name) {
        Element element = null;
        int size = (nodelist == null) ? 0 : nodelist.getLength();
        for (int i = 0; i < size; i++) {
            element = (Element) nodelist.item(i);
            if (name.equalsIgnoreCase(element.getNodeName())) {
                break;
            }
        }
        return element;
    }
}