Here you can find the source of parseFloat(String attributeName, NamedNodeMap map)
Parameter | Description |
---|---|
attributeName | the name of the attribute. |
map | the map that contains all the attributes. |
public static float parseFloat(String attributeName, NamedNodeMap map)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.NamedNodeMap; public class Main { /**/*from ww w . j a va 2 s. c o m*/ * Parses the value of the given attribute as a float. * @param attributeName the name of the attribute. * @param map the map that contains all the attributes. * @return the float value. */ public static float parseFloat(String attributeName, NamedNodeMap map) { org.w3c.dom.Node attr = map.getNamedItem(attributeName); try { return attr != null ? Float.parseFloat(attr.getTextContent()) : 0f; } catch (NumberFormatException ex) { return 0.0f; } } }