Java XML Attribute Get getBooleanAttribute(Element el, String name)

Here you can find the source of getBooleanAttribute(Element el, String name)

Description

get Boolean Attribute

License

Apache License

Declaration

public static boolean getBooleanAttribute(Element el, String name) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Element;

public class Main {
    public static boolean getBooleanAttribute(Element el, String name) {
        String s = el.getAttribute(name);
        if (s == null || "0".equals(s)) {
            return false;
        }//from w w  w.j  a v a2s .  co  m
        if ("1".equals(s)) {
            return true;
        }
        return new Boolean(s).booleanValue();
    }
}

Related

  1. getBoolAttribute(Node node, String name, boolean defVal)
  2. getBoolean(Element element, String attribute, boolean defaultValue)
  3. getBooleanAttr(Element element, String name)
  4. getBooleanAttrib(Element element, String attribName, String namespaceURI)
  5. getBooleanAttribute(Element e, String name)
  6. getBooleanAttribute(Element elem, String attName, boolean mandatory)
  7. getBooleanAttribute(Element elem, String attName, boolean mandatory, boolean defaultValue)
  8. getBooleanAttribute(Element element, String attributeName)
  9. getBooleanAttribute(Element element, String key, boolean defValue)