Here you can find the source of getAttributes(final Node node, final String[] attributeNames)
public static String[] getAttributes(final Node node, final String[] attributeNames)
//package com.java2s; //License from project: LGPL import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static String[] getAttributes(final Node node, final String[] attributeNames) { final String[] valueList = new String[attributeNames.length]; final NamedNodeMap attMap = node.getAttributes(); Node tmpNode = null;/*w w w. j a va 2s . co m*/ for (int i = 0; i < attributeNames.length; i++) { try { tmpNode = attMap.getNamedItem(attributeNames[i]); valueList[i] = tmpNode.getNodeValue(); } catch (Exception e) { valueList[i] = ""; } } // next attribute return valueList; } }