Here you can find the source of getFirstChildElement(Element parent, String tagName)
Parameter | Description |
---|---|
parent | The parent element for which the child must be retrieved. |
tagName | The name of the child that must be retrieved. |
public static Element getFirstChildElement(Element parent, String tagName)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Element; public class Main { /**/* ww w . java 2 s.c o m*/ * Get the first child element of a given name a parent element. * * @param parent * The parent element for which the child must be retrieved. * @param tagName * The name of the child that must be retrieved. * @return */ // Get first child element by name public static Element getFirstChildElement(Element parent, String tagName) { return (Element) parent.getElementsByTagName(tagName).item(0); } }