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

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

Description

get Attribute

License

Open Source License

Declaration

public static String getAttribute(String attribute, Node node) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Node;

public class Main {
    public static String getAttribute(String attribute, Node node) {
        if (node != null) {
            Node attr = node.getAttributes().getNamedItem(attribute);
            if (attr != null) {
                return attr.getNodeValue().trim();
            }//from   www .  java2s. co  m
        }
        return null;
    }
}

Related

  1. getAttribute(Node node, String name, String defVal)
  2. getAttribute(Node pNode, String attrName)
  3. getAttribute(Node pNode, String pName)
  4. getAttribute(Node targetElem, String keyName, String defaultValue)
  5. getAttribute(String aAttrName, Node aNode)
  6. getAttribute(String attribute, Node node)
  7. getAttribute(String attribute, Node node)
  8. getAttribute(String key, NamedNodeMap map)
  9. getAttribute(String name, Element el)