Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import org.w3c.dom.*;

public class Main {
    /**
     *  Returns the first child element found with the specified tag name
     *  @param node The node to search
     *  @param element The element tag name to search for
     *  @return The matching element Node
     */
    public synchronized static Node getFirstElementIgnoreCase(Node node, String element) {
        if (node != null && element != null) {
            NodeList nl = node.getChildNodes();

            for (int i = 0; i < nl.getLength(); i++) {
                Node n = nl.item(i);

                if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equalsIgnoreCase(element)) {
                    return n;
                }
            }
        }

        return null;
    }
}