Java tutorial
//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 { return Integer.parseInt(e.getAttribute(attrName)); } catch (Exception exc) { return -1; } } }