Here you can find the source of getAttribute(Node node, String name)
public static String getAttribute(Node node, 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 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(); } }