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

public static String getAttributeValue(Node node, String name) 

Method Source Code

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

public class Main {
    public static String getAttributeValue(Node node, String name) {
        Node attr = getAttribute(node, name);
        return (attr != null) ? attr.getNodeValue() : null;
    }/*from  w  w  w .j av a2  s  .c  o  m*/

    public static String getAttribute(Element element, String name) {
        Attr attr = element.getAttributeNode(name);
        return (attr != null) ? attr.getValue() : null;
    }

    public static Node getAttribute(Node node, String name) {
        return node.getAttributes().getNamedItem(name);
    }
}

Related

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