Here you can find the source of getFirstNamedChildNode(Element element, String string)
public static Node getFirstNamedChildNode(Element element, String string)
//package com.java2s; /******************************************************************************* * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version.//from w w w. ja va 2 s.c o m * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * Contributors: * Gregory Amerson - initial implementation and ongoing maintenance *******************************************************************************/ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node getFirstNamedChildNode(Element element, String string) { NodeList children = element.getChildNodes(); if (children != null && children.getLength() > 0) { for (int i = 0; i < children.getLength(); i++) { Node item = children.item(i); if (item.getNodeName().equals(string)) { return item; } } } return null; } }