Java XML Attribute Get getBooleanAttributeOption(final Element configuration, final String option, boolean defaultValue)

Here you can find the source of getBooleanAttributeOption(final Element configuration, final String option, boolean defaultValue)

Description

get Boolean Attribute Option

License

Open Source License

Declaration

public static boolean getBooleanAttributeOption(final Element configuration, final String option,
            boolean defaultValue) 

Method Source Code


//package com.java2s;
/*//from   w w w . j a v  a2s  .c  o  m
 * Copyright 2001-2008 Aqris Software AS. All rights reserved.
 * 
 * This program is dual-licensed under both the Common Development
 * and Distribution License ("CDDL") and the GNU General Public
 * License ("GPL"). You may elect to use one or the other of these
 * licenses.
 */

import org.w3c.dom.Element;

public class Main {
    public static boolean getBooleanAttributeOption(final Element configuration, final String option,
            boolean defaultValue) {
        if (configuration == null) {
            return defaultValue;
        }

        String value = configuration.getAttribute(option);
        return Boolean.valueOf(value).booleanValue();
    }
}

Related

  1. getBooleanAttribute(Element element, String name)
  2. getBooleanAttribute(Element element, String name, boolean defaultValue)
  3. getBooleanAttribute(Node n, String attributeName)
  4. getBooleanAttribute(Node targetElem, String keyName, boolean defaultValue)
  5. getBooleanAttributeByName(Node content, String attributeName, boolean defaultTrue)
  6. getBooleanAttributeOptional(Node node, String attributeName, Boolean valueIfEmpty)
  7. getBooleanAttributeRequired(Node node, String attributeName)
  8. getBooleanAttributeValue(Node node, String attribute)
  9. getCascadeValue(final Element elem, final String attrName)