Android XML Node Attribute Get getElementAttr(Node element, String attrName)

Here you can find the source of getElementAttr(Node element, String attrName)

Description

get Element Attr

Declaration

public static String getElementAttr(Node element, String attrName) 

Method Source Code

//package com.java2s;
import org.w3c.dom.Node;

public class Main {
    public static String getElementAttr(Node element, String attrName) {
        for (int i = 0; i < element.getAttributes().getLength(); i++) {
            Node child = element.getAttributes().item(i);
            if (child.getNodeName().equals(attrName)) {
                return child.getNodeValue();
            }//from  w  w w.jav a2  s  .  c  om
        }

        return null;
    }
}

Related

  1. getAttribute(Node node, String name)
  2. getAttributeValue(Node node, String attributeName)
  3. getAttributeValue(Node node, String attributeName)
  4. getAttributeValueAsInt(Node node, String attributeName)
  5. getElementAttr(Node element, String attrName)
  6. getElementIntAttr(Node element, String attrName)
  7. getElementIntAttr(Node element, String attrName)
  8. getEnumAttribute(Node archiveNode, String attrName, Object[] values, Object defaultValue)
  9. getNodeAttribute(Node node, String name)