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

public class Main {
    public static Double get_double(Element element, String name) {
        Double d = null;
        NodeList list = element.getElementsByTagName(name);
        if (list.getLength() > 0) {
            try {
                d = Double.valueOf(list.item(0).getTextContent());
            } catch (NumberFormatException e) {
                System.err.println(e);
                return null;
            }
        } else {
            System.err.println("No \"" + name + "\" defined");
            return null;
        }

        return d;
    }
}