Java XML Attribute Get getAttrValue(Node n, String name)

Here you can find the source of getAttrValue(Node n, String name)

Description

get Attr Value

License

Open Source License

Declaration

public static String getAttrValue(Node n, 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 {
    public static String getAttrValue(Node n, String name) {
        NamedNodeMap attrs = n.getAttributes();
        return (attrs.getNamedItem(name) != null) ? attrs.getNamedItem(name).getNodeValue() : null;
    }//from w ww.j a v a  2s .c om
}

Related

  1. getAttrsAsString(Node node)
  2. getAttrString(Element elem, String localName)
  3. getAttrVal(final NamedNodeMap nnm, final String name)
  4. getAttrValue(NamedNodeMap attrs, String attrName)
  5. getAttrvalue(Node item, String name, boolean ignoreNs)
  6. getAttrValuesByName(Element ele, String attributeName)
  7. getBeanclassAttribute(Node node)
  8. getBool(Element el, String attrName, boolean defaultValue)
  9. getBoolAttribute(NamedNodeMap namedNodeMap, String name)