Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.*;

public class Main {
    public static String getTagValue(String sTag, Element eElement) {
        if (eElement == null) {
            return null;
        }
        NodeList aNodeList = eElement.getElementsByTagName(sTag);
        if (aNodeList == null) {
            return null;
        }
        Node aNode = aNodeList.item(0);
        if (aNode == null) {
            return null;
        }
        NodeList nlList = aNode.getChildNodes();
        Node nValue = (Node) nlList.item(0);
        if (nValue == null) {
            return null;
        }
        return nValue.getNodeValue();
    }
}