Here you can find the source of getAllAttrValueByName(Node item, String name)
public static List<String> getAllAttrValueByName(Node item, String name)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static List<String> getAllAttrValueByName(Node item, String name) { List<String> lst = null; 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(); if (name.equals(attrName)) { if (lst == null) { lst = new ArrayList(); }//from w ww.j ava 2 s. com lst.add(attr.getNodeValue()); } } return lst; } }