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 final int ERROR = 1;
    private static int lastState;

    public static double getDoubleAttribute(Element node, String attr) {
        double retValue = 0;
        try {
            String s = node.getAttribute(attr);
            s = s.replace(',', '.');
            //retValue = Double.parseDouble( s );
            retValue = Double.valueOf(s).doubleValue();
        } catch (NumberFormatException ex) {
            System.err.println("Parse error:" + ex.getMessage() + " while reading attr: " + attr);
            lastState = ERROR;
        }
        return retValue;
    }
}