Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static String getNodeText(Node parentNode, String nodeName) {
        Element fstElmnt = (Element) parentNode;
        NodeList fstNmElmntLst = fstElmnt.getElementsByTagName(nodeName);
        Element fstNmElmnt = (Element) fstNmElmntLst.item(0);
        NodeList fstNm = fstNmElmnt.getChildNodes();
        String ret = fstNm.item(0).getNodeValue();
        return ret;
    }

    public static String getNodeText(Node node) {
        NodeList fstNm = node.getChildNodes();
        String ret = fstNm.item(0).getNodeValue();
        return ret;
    }
}