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

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

            Element el = (Element) node;
            NodeList nodeList = el.getElementsByTagName(nodeName);
            if (nodeList.getLength() > 0) {
                return nodeList.item(0);
            }

        }

        return null;
    }
}