Java XML Attribute from Node getNodeAttributeValue(Node node, String attributeName)

Here you can find the source of getNodeAttributeValue(Node node, String attributeName)

Description

get Node Attribute Value

License

Open Source License

Declaration

public static String getNodeAttributeValue(Node node, String attributeName) 

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 getNodeAttributeValue(Node node, String attributeName) {
        NamedNodeMap attributes = node.getAttributes();
        if (attributes == null)
            return null;

        Node attributeValue = attributes.getNamedItem(attributeName);
        return attributeValue == null ? null : attributeValue.getNodeValue();
    }//from w  w  w .j a va 2 s  . c  om
}

Related

  1. getNodeAttributeDeep(NodeList nodelList, String nodeName, String nodeAttr)
  2. getNodeAttributes(final Node node)
  3. getNodeAttributesToString(Node node)
  4. getNodeAttributeValue(Node element, String attributeName)
  5. getNodeAttributeValue(Node node, String attribute)
  6. getNodeAttributeValue(Node node, String attributeName)
  7. getNodeAttributeValue(Node node, String attrName)
  8. getNodeAttributeValueNS(Node node, String namespaceURI, String attrName)
  9. getNodeMap(NamedNodeMap artifactAttributes)