Here you can find the source of getAttributes(Node node)
public static Map<String, String> getAttributes(Node node)
//package com.java2s; /*// w w w . ja va 2 s . com * Copyright (c) 2007-2012 The Broad Institute, Inc. * SOFTWARE COPYRIGHT NOTICE * This software and its documentation are the copyright of the Broad Institute, Inc. All rights are reserved. * * This software is supplied without any warranty or guaranteed support whatsoever. The Broad Institute is not responsible for its use, misuse, or functionality. * * This software is licensed under the terms of the GNU Lesser General Public License (LGPL), * Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php. */ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, String> getAttributes(Node node) { HashMap<String, String> attributes = new HashMap(); NamedNodeMap tNodeMap = node.getAttributes(); if (tNodeMap != null) { for (int i = 0; i < tNodeMap.getLength(); i++) { Node nd = tNodeMap.item(i); String value = nd.getNodeValue(); if (value != null && value.length() > 0) { attributes.put(nd.getNodeName(), value); } } } return attributes; } }