Android XML Element Child Get getChild(Element element, String name)

Here you can find the source of getChild(Element element, String name)

Description

Get the first child element with the given name.

Parameter

Parameter Description
element The parent element
name The child element name

Return

The child element or null

Declaration

public static Element getChild(Element element, String name) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Element;

public class Main {
    /**// www .j  a  va  2 s.c om
     * Get the first child element with the given name.
     *
     * @param element The parent element
     * @param name The child element name
     * @return The child element or null
     */
    public static Element getChild(Element element, String name) {
        return (Element) element.getElementsByTagName(name).item(0);
    }
}

Related

  1. findChildElement(Element parent, String name)
  2. findChildElementWithAttribute(Element parent, String name, String attribute, String value)
  3. findChildren(Element parent, String tagName)
  4. findFirstChildElement(Element parent)
  5. firstChildWithName(Element element, String name)
  6. getChildByType(Element element, short nodeType)
  7. getChildElementByName(Element parent, String name)
  8. getChildValue(Element element, String name)
  9. getFullTextChildrenFromElement(Element element)