Java tutorial
//package com.java2s; //License from project: Open Source License import org.w3c.dom.NamedNodeMap; public class Main { /** * Parses the value of the given attribute as an float. * @param attributeName the name of the attribute. * @param map the map that contains all the attributes. * @return the float value. */ public static int parseInt(String attributeName, NamedNodeMap map) { org.w3c.dom.Node attr = map.getNamedItem(attributeName); try { return attr != null ? Integer.parseInt(attr.getTextContent()) : 0; } catch (NumberFormatException ex) { return 0; } } }