Here you can find the source of getAttribute(final Node node, final String name)
public static final Node getAttribute(final Node node, final String name)
//package com.java2s; //License from project: Apache License import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static final Node getAttribute(final Node node, final String name) { if (node == null) { throw new IllegalArgumentException("The node is null."); } else if (name == null || name.isEmpty()) { throw new IllegalArgumentException("The attribute's name is null or empty."); } else {//from w w w . j a v a 2s . com final NamedNodeMap namedNodeMap = node.getAttributes(); if (namedNodeMap != null) { return namedNodeMap.getNamedItem(name); } } return null; } }