Java XML Attribute from Element getElementBooleanValue(Element element, String attribute)

Here you can find the source of getElementBooleanValue(Element element, String attribute)

Description

get Element Boolean Value

License

Apache License

Declaration

public static boolean getElementBooleanValue(Element element, String attribute) 

Method Source Code


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

import org.w3c.dom.Element;

public class Main {
    public static boolean getElementBooleanValue(Element element, String attribute) {
        return getElementBooleanValue(element, attribute, false);
    }/*from ww w. ja va2s  .  c  om*/

    public static boolean getElementBooleanValue(Element element, String attribute, boolean defaultValue) {
        if (!element.hasAttribute(attribute))
            return defaultValue;
        return Boolean.valueOf(getElementStringValue(element, attribute)).booleanValue();
    }

    public static String getElementStringValue(Element element, String attribute) {
        return element.getAttribute(attribute);
    }
}

Related

  1. getElementAttribute(Element root, String elementName, String attribute)
  2. getElementAttribute(Element root, String elemName, String att)
  3. getElementAttributes(Element element, List exclude)
  4. getElementAttributeValue(Element element, String attributeName)
  5. getElementBooleanValue(Element element, String attribute)
  6. getElementBooleanValue(Element element, String attribute, boolean defaultValue)
  7. getElementByAttr(NodeList elements, String attrName)
  8. getElements(Element root, String tagName, String attrName)
  9. getElementsByTagAndAttr(Element parent, String elemName, String attrName, String attrVal)