Java XML Attribute from Element getXMLAttributeValueAsBoolean(Element node, String attributeName)

Here you can find the source of getXMLAttributeValueAsBoolean(Element node, String attributeName)

Description

Get the boolean value of an attribute that belongs to an XML element

License

Apache License

Parameter

Parameter Description
node XML element
attributeName Name of the boolean attribute

Declaration

public static boolean getXMLAttributeValueAsBoolean(Element node, String attributeName) 

Method Source Code

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

import org.w3c.dom.Element;

public class Main {
    /**/*from w  ww.  j  a  va2  s .  com*/
     * Get the boolean value of an attribute that belongs to an XML element
     * 
     * @param node
     *            XML element
     * @param attributeName
     *            Name of the boolean attribute
     * @return
     */
    public static boolean getXMLAttributeValueAsBoolean(Element node, String attributeName) {
        return Boolean.parseBoolean(getXMLAttributeValue(node, attributeName));
    }

    /**
     * Get the value of an attribute that belongs to an XML element.
     * 
     * @param node
     *            XML element
     * @param attributeName
     *            Name of the attribute
     * @return
     */
    public static String getXMLAttributeValue(Element node, String attributeName) {
        return node.getAttribute(attributeName);
    }
}

Related

  1. getValueAttribute(final Node aNode)
  2. getValueAttributeUri(Element parent, String defaultBaseUri)
  3. getValueForAttribute(String attributeName, Node parentNode)
  4. getXMLAttribute(Element element, String attrName)
  5. getXMLAttributeValue(Element node, String attributeName)
  6. incrementAttributeValue(Node node, String attName)
  7. isHTMLInputFileValueAttr(Node node, String attrName)