Here you can find the source of getAttributesNamesOf(Element element)
Parameter | Description |
---|---|
element | The Element to get the attribute names of. |
public static String[] getAttributesNamesOf(Element element)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.*; public class Main { /**//from w w w. j a v a 2 s. c o m * Gets the names of all the attributes of the given {@link Element}. * * @param element The {@link Element} to get the attribute names of. * @return Returns an array, possibly empty, of the attribute names. */ public static String[] getAttributesNamesOf(Element element) { final NamedNodeMap map = element.getAttributes(); final int numAttributes = map.getLength(); final String[] result = new String[numAttributes]; for (int i = 0; i < numAttributes; ++i) result[i] = map.item(i).getNodeName(); return result; } }