Java XML Attribute Get getAttributeAsBoolean(Element element, String attrName, boolean defValue)

Here you can find the source of getAttributeAsBoolean(Element element, String attrName, boolean defValue)

Description

get Attribute As Boolean

License

Open Source License

Declaration

public static final boolean getAttributeAsBoolean(Element element, String attrName, boolean defValue) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Element;

public class Main {
    public static final boolean getAttributeAsBoolean(Element element, String attrName, boolean defValue) {
        String value = element.getAttribute(attrName);

        try {/*from  www  . j  av  a  2s  . com*/
            if ((value != null) && (value.length() > 0)) {
                return Boolean.valueOf(value).booleanValue();
            }
        } catch (Exception ex) {
        }

        return defValue;
    }
}

Related

  1. getAttribute(String name, Element el)
  2. getAttribute(String name, Element element)
  3. getAttribute(String name, Element firstElement, Element secondElement)
  4. getAttribute(String name, Node node)
  5. getAttributeAsBoolean(Element elem, String attribName)
  6. getAttributeAsBoolean(Element element, String attrName, boolean defValue)
  7. getAttributeAsBoolean(Element element, String name)
  8. getAttributeAsBoolean(NamedNodeMap map, String name)
  9. getAttributeAsInteger(Element element, String attrName, Integer defValue)