Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    /**
     * Returns the first child node matching the {@code tagName}.
     */
    public static Node findNode(Node parent, String tagName) {
        Node result = null;

        NodeList nl = parent.getChildNodes();
        for (int i = 0; i < nl.getLength(); i++) {
            if (nl.item(i).getNodeName().equals(tagName)) {
                return nl.item(i);
            }
        }

        return result;
    }
}