Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    /**
     * Gets tag value from XML entry.
     * @param tag         XML tag String.
     * @param xmlElement   XML Element Object.
     * @return            Integer.parseInt(((Node) lastNodeList.item(0)).getNodeValue()).
     */
    public static String getEntry(String tag, Element xmlElement) {
        NodeList nodeList = xmlElement.getElementsByTagName(tag);
        Element element = (Element) nodeList.item(0);
        NodeList lastNodeList = element.getChildNodes();
        return lastNodeList.item(0).getNodeValue();
    }
}