Java tutorial
//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 getShiftId(Node node) { String name = ""; NodeList nodeList = node.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node curNode = nodeList.item(i); if ("shiftId".equalsIgnoreCase(curNode.getNodeName())) { name = curNode.getTextContent().replace("\"", ""); break; } } return name; } 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; } } return name; } }