Java XML Attribute Get getAttributeValue(Node node, String name)

Here you can find the source of getAttributeValue(Node node, String name)

Description

get Attribute Value

License

Open Source License

Declaration

static public String getAttributeValue(Node node, String name) 

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 {
    static public String getAttributeValue(Node node, String name) {
        Node attribute = getAttribute(node, name);

        if (attribute != null) {
            return attribute.getNodeValue();
        }/*from   w w  w .  ja v  a  2 s. co m*/

        return null;
    }

    static public Node getAttribute(Node node, String name) {
        NamedNodeMap attributes = node.getAttributes();

        return attributes.getNamedItem(name);
    }
}

Related

  1. getAttributeValue(Node node, String attributeName)
  2. getAttributeValue(Node node, String attributeName)
  3. getAttributeValue(Node node, String attributeName, int defaultValue)
  4. getAttributeValue(Node node, String attrName)
  5. getAttributeValue(Node node, String attrName)
  6. getAttributeValue(Node node, String name)
  7. getAttributeValue(Node node, String name)
  8. getAttributeValue(Node node, String name, boolean defaultValue)
  9. getAttributeValue(Node node, String name, String defaultValue)