Java tutorial
//package com.java2s; /* * XmlUtil.java * * (c) 2009 The Echo Nest * See "license.txt" for terms * * */ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static void dump(Node node) { System.out.println("Node: " + node.getNodeName()); NamedNodeMap nnm = node.getAttributes(); if (nnm != null) { for (int i = 0; i < nnm.getLength(); i++) { Node n = nnm.item(i); System.out.println(" " + n.getNodeName() + ":" + n.getNodeValue()); } } } }