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

public class Main {
    public static Node findChildNode(Node node, String name) {
        Node child;
        NodeList list;

        list = node.getChildNodes();
        for (int i = 0; i < list.getLength(); i++) {
            child = list.item(i);
            if (child instanceof Element && child.getNodeName().equals(name)) {
                return child;
            }
        }

        return null;
    }
}