Java XML Attribute from Node getLowerAttrValue(Node node, String attr)

Here you can find the source of getLowerAttrValue(Node node, String attr)

Description

get Lower Attr Value

License

Open Source License

Declaration

public static String getLowerAttrValue(Node node, String attr) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static String getLowerAttrValue(Node node, String attr) {
        String value = getAttrValue(node, attr);
        if (value != null) {
            return value.toLowerCase();
        } else {//from  ww w .j a  va 2 s .c om
            return null;
        }
    }

    public static String getAttrValue(Node node, String attr) {
        NamedNodeMap attrs = node.getAttributes();
        Node baseAttr = attrs.getNamedItem(attr);
        if (baseAttr == null) {
            return "";
        }
        return baseAttr.getNodeValue();
    }
}

Related

  1. getIntAttributeValue(Node node, String attribute)
  2. getIntAttrId(Node aNode, String aAttrName)
  3. getIntegerAttribute(Node n, String attributeName)
  4. getIntegerAttribute(Node node, String att_name)
  5. getLongAttributeByName(Node node, String name, long defaultValue)
  6. getNextSiblingElement(Node node, String elemName, String attrName, String attrValue)
  7. getNodeAttr(String attrName, Node node)
  8. getNodeAttr(String attrName, Node node)
  9. getNodeAttr(String tagName, String attrName, NodeList nodes)