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

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

Description

get Attribute

License

Apache License

Declaration

public static String getAttribute(Node node, String name) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static String getAttribute(Node node, String name) {
        NamedNodeMap namedNodeMap = node.getAttributes();
        if (namedNodeMap == null) {
            return null;
        }/*from w w  w . j  ava2 s  .  c om*/
        Node attrNode = namedNodeMap.getNamedItem(name);
        if (attrNode == null) {
            return null;
        }
        return attrNode.getNodeValue();
    }
}

Related

  1. getAttribute(Node node, String attrName)
  2. getAttribute(Node node, String localName, String namespaceURI)
  3. getAttribute(Node node, String localName, String namespaceURI)
  4. getAttribute(Node node, String name)
  5. getAttribute(Node node, String name)
  6. getAttribute(Node node, String name)
  7. getAttribute(Node node, String name)
  8. getAttribute(Node node, String name)
  9. getAttribute(Node node, String name)