Java XML Attribute Get getAttributeValueAsDouble(Node node, String attributeName)

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

Description

get Attribute Value As Double

License

Open Source License

Declaration

public static Double getAttributeValueAsDouble(Node node, String attributeName) 

Method Source Code


//package com.java2s;

import org.w3c.dom.Node;

public class Main {
    public static Double getAttributeValueAsDouble(Node node, String attributeName, Double defaultValue) {
        final Node attributeNode = node.getAttributes().getNamedItem(attributeName);
        return attributeNode != null ? Double.parseDouble(attributeNode.getTextContent()) : defaultValue;
    }/*from  ww  w  .  j  a va 2 s.  com*/

    public static Double getAttributeValueAsDouble(Node node, String attributeName) {
        return Double.parseDouble(node.getAttributes().getNamedItem(attributeName).getTextContent());
    }
}

Related

  1. getAttributeValue(StartElement element, String namespaceURI, String localPart)
  2. getAttributeValue(StartElement startElement, String attributeName)
  3. getAttributeValue(String attributeName, Node xmlNode)
  4. getAttributeValueAsBoolean(Attr attribute)
  5. getAttributeValueAsBoolean(Element el, String attrName)
  6. getAttributeValueAsInteger(Node node, String attributeName, Integer defaultValue)
  7. getAttributeValueAsLong(final Element el, final String attrName, final long defaultVal)
  8. getAttributeValueAsString(Node node)
  9. getAttributeValueBoolean(Node node, String attrName)