Java XML Attribute Set attributeFloat(Node node, String attributeName)

Here you can find the source of attributeFloat(Node node, String attributeName)

Description

attribute Float

License

Open Source License

Declaration

public static float attributeFloat(Node node, String attributeName) 

Method Source Code


//package com.java2s;
import org.w3c.dom.Node;

public class Main {
    public static float attributeFloat(Node node, String attributeName) {

        return Float.parseFloat(attributeString(node, attributeName));
    }// w w w .j  a  v a  2s. co m

    public static String attributeString(Node node, String attributeName) {
        if (node.hasAttributes()) {
            Node attr = node.getAttributes().getNamedItem(attributeName);
            if (attr != null) {
                return attr.getNodeValue();
            }
        }

        return null;

    }
}

Related

  1. attribute(Element element, String attrName)
  2. attribute(Node node, String... attributes)
  3. attributeBooleanGet(Element e, String name, boolean defaultValue)
  4. attributeBooleanSet(Element base, String name, boolean value, boolean defaultValue)
  5. attributeBoolValue(Element e, String attr)
  6. attributeIntValue(Element e, String attr)
  7. attributeMap(Element element)
  8. attributeOrNull(Node node, String... attributes)
  9. attributeOrValue(Element element, String mainAttribute, String... alternateAttributes)