Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

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

public class Main {
    public static Node getChildNode(Node node, String nodeName) {
        if (node.getNodeType() == Node.ELEMENT_NODE) {

            NodeList nodeList = node.getChildNodes();
            for (int i = 0; i < nodeList.getLength(); i++) {
                Node n = nodeList.item(i);
                if (n.getNodeName().equals(nodeName)) {
                    return n;
                }
            }
        }

        return null;
    }
}