Java XML Attribute Add readDoubleAttr(Element element, String attributeName, double defaultValue)

Here you can find the source of readDoubleAttr(Element element, String attributeName, double defaultValue)

Description

read Double Attr

License

Open Source License

Declaration

public static double readDoubleAttr(Element element, String attributeName, double defaultValue) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Element;

public class Main {
    public static double readDoubleAttr(Element element, String attributeName, double defaultValue) {
        String attributeValue = element.getAttribute(attributeName);
        try {/*from   w ww  .  j  a  v a2 s.co m*/
            return Double.parseDouble(attributeValue);
        } catch (NumberFormatException e) {
            return defaultValue;
        }
    }
}

Related

  1. addOrUpdateAttribute(Element element, String name, String value)
  2. addPropertyReferenceIfNeeded(BeanDefinitionBuilder bdb, Element element, String attributeName)
  3. addRequiredPropertyValue(BeanDefinitionBuilder builder, String propertyName, Element element, String attributeName)
  4. addTextElement(Node parent, String name, String value, Attr[] attrs)
  5. addTypeAttribute(Element element, String type)