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.*;

public class Main {
    public static String findNodeValue(Element firstElement, String name) {
        String nodeValue = null;
        NodeList firstNameList = firstElement.getElementsByTagName(name);
        Element firstNameElement = (Element) firstNameList.item(0);

        NodeList textFNList = firstNameElement.getChildNodes();

        if (textFNList.getLength() > 0) {
            nodeValue = (textFNList.item(0)).getNodeValue();
        }
        return nodeValue;
    }
}