Here you can find the source of getAttrvalue(Node item, String name, boolean ignoreNs)
public static String getAttrvalue(Node item, String name, boolean ignoreNs)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static String getAttrvalue(Node item, String name, boolean ignoreNs) { NamedNodeMap attributes = item.getAttributes(); int numAttrs = attributes.getLength(); for (int i = 0; i < numAttrs; i++) { Attr attr = (Attr) attributes.item(i); String attrName = attr.getNodeName(); String NSName = attr.getNamespaceURI(); if (ignoreNs) { if ((attrName.indexOf(":" + name) != -1) || (name.equals(attrName))) return attr.getNodeValue(); } else { if (name.equals(attrName)) { return attr.getNodeValue(); }/*w ww . j a va 2 s . c om*/ } } return null; } }