Here you can find the source of getAttributeNames(Element el)
public static String[] getAttributeNames(Element el)
//package com.java2s; import org.w3c.dom.*; public class Main { /** Gets a list of all attribute names for the given DOM element. */ public static String[] getAttributeNames(Element el) { NamedNodeMap map = el.getAttributes(); int len = map.getLength(); String[] attrNames = new String[len]; for (int i = 0; i < len; i++) { Attr attr = (Attr) map.item(i); attrNames[i] = attr == null ? null : attr.getName(); }/*from www.j av a 2s .c om*/ return attrNames; } /** Gets the local (sans namespace) name of the given node. */ public static String getName(Node node) { // NB: The node.getLocalName() method does not work. String name = node.getNodeName(); int colon = name.lastIndexOf(":"); return colon < 0 ? name : name.substring(colon + 1); } }