Here you can find the source of getNodeName(Node node)
private static String getNodeName(Node node)
//package com.java2s; /************************************************************************************** * Copyright (C) 2012 Lisa park, Inc. All rights reserved. * http://www.lisa-park.com * * E-Mail: alexmy@lisa-park.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt * **************************************************************************************/ import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { private static String getNodeName(Node node) { String name = ""; NodeList nodeList = node.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node curNode = nodeList.item(i); if ("name".equalsIgnoreCase(curNode.getNodeName())) { name = curNode.getTextContent().replace("\"", ""); break; }/* ww w. j a va 2 s . co m*/ } return name; } }