Java XML Attribute Get getBoolAttribute(NamedNodeMap namedNodeMap, String name)

Here you can find the source of getBoolAttribute(NamedNodeMap namedNodeMap, String name)

Description

get Bool Attribute

License

Apache License

Declaration

public static Boolean getBoolAttribute(NamedNodeMap namedNodeMap, String name) 

Method Source Code


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

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class Main {
    public static boolean getBoolAttribute(NamedNodeMap namedNodeMap, String name, boolean defaultValue) {
        Boolean value = getBoolAttribute(namedNodeMap, name);
        return value == null ? defaultValue : value;
    }//w w  w  .j av  a  2s. c o  m

    public static Boolean getBoolAttribute(NamedNodeMap namedNodeMap, String name) {
        String value = getAttribute(namedNodeMap, name);
        if (value == null) {
            return null;
        } else {
            return Boolean.valueOf(value);
        }
    }

    public static String getAttribute(NamedNodeMap namedNodeMap, String name) {
        Node node = namedNodeMap.getNamedItem(name);
        if (node == null) {
            return null;
        }
        return node.getNodeValue();
    }
}

Related

  1. getAttrvalue(Node item, String name, boolean ignoreNs)
  2. getAttrValue(Node n, String name)
  3. getAttrValuesByName(Element ele, String attributeName)
  4. getBeanclassAttribute(Node node)
  5. getBool(Element el, String attrName, boolean defaultValue)
  6. getBoolAttribute(Node node, String attr)
  7. getBoolAttribute(Node node, String name)
  8. getBoolAttribute(Node node, String name, boolean defVal)
  9. getBoolean(Element element, String attribute, boolean defaultValue)