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 {
    /**
     * Parses the given attribute of this tag and returns it as an int.
     */
    public static int getAttribInt(Element ele, String name) {
        String sval = ele.getAttribute(name);
        int val = 0;
        try {
            val = Integer.parseInt(sval);
        } catch (Exception e) {
        }

        return val;
    }

    public static int parseInt(String val) {
        if (val == null)
            return 0;

        int retVal = 0;
        try {
            retVal = Integer.parseInt(val);
        } catch (Exception e) {
        }
        return retVal;
    }
}