Here you can find the source of getElementIntAttribute(Element e, String whichAttribute)
static int getElementIntAttribute(Element e, String whichAttribute)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; public class Main { static int getElementIntAttribute(Element e, String whichAttribute) { int val = -1; String number = e.getAttribute(whichAttribute); if (number != null) { try { val = Integer.parseInt(number.trim()); } catch (NumberFormatException ex) { val = -1; }/*from w w w .j a v a 2 s . c o m*/ } return val; } }