Here you can find the source of getAttributeNames(Element element)
public static List<String> getAttributeNames(Element element)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; public class Main { public static List<String> getAttributeNames(Element element) { List<String> names = new ArrayList<String>(); NamedNodeMap list = element.getAttributes(); for (int i = 0; i < list.getLength(); i++) { names.add(list.item(i).getNodeName()); }//from w ww .j av a 2 s . c om return names; } }