Here you can find the source of getXMLInt(Element e, String attrName)
public static int getXMLInt(Element e, String attrName)
//package com.java2s; // modify it under the terms of the GNU General Public License import org.w3c.dom.Element; public class Main { public static int getXMLInt(Element e, String attrName) { try {/*from w w w .jav a 2 s .c o m*/ return Integer.parseInt(e.getAttribute(attrName)); } catch (Exception exc) { return -1; } } public static String getAttribute(Element e, String attrName, String def) { String result = e.getAttribute(attrName); if (!hasValue(result)) result = def; return result; } public static boolean hasValue(String val) { return (val != null && val.length() > 0); } }