Here you can find the source of getChildNodeValue(Element node, String tagName)
private static String getChildNodeValue(Element node, String tagName)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013,2014 Red Hat, Inc. * Distributed under license by Red Hat, Inc. All rights reserved. * This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors:// w w w . j av a 2 s .c o m * Red Hat, Inc. - initial API and implementation ******************************************************************************/ import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { private static String getChildNodeValue(Element node, String tagName) { NodeList nodes = node.getElementsByTagName(tagName); if (nodes.getLength() > 0) { return nodes.item(0).getTextContent().trim(); } return null; } }