Java XML Attribute Get getAttr(final Node n, final String attr)

Here you can find the source of getAttr(final Node n, final String attr)

Description

get Attr

License

Open Source License

Declaration

public static String getAttr(final Node n, final String attr) 

Method Source Code

//package com.java2s;
// Licensed under the MIT license. See License.txt in the repository root.

import org.w3c.dom.Node;

public class Main {
    public static String getAttr(final Node n, final String attr) {
        final Node attrNode = n.getAttributes().getNamedItem(attr);
        if (attrNode != null) {
            return attrNode.getNodeValue();
        }//from   ww  w . j  a va 2  s.c  o m
        return null;
    }
}

Related

  1. getAtrributeValue(Node node, String attribute)
  2. getAttr(Element e, String name)
  3. getAttr(Element elem, String name)
  4. getAttr(final Node n, final String attrName)
  5. getAttr(NamedNodeMap attrs, String name)
  6. getAttr(NamedNodeMap attrs, String name, String missing_err)
  7. getAttr(Node n, String name)