Java XML First Child Element getFirstChildWithTagName(Element parent, String tagName)

Here you can find the source of getFirstChildWithTagName(Element parent, String tagName)

Description

get First Child With Tag Name

License

Open Source License

Declaration

public static Element getFirstChildWithTagName(Element parent,
            String tagName) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Element;

import org.w3c.dom.NodeList;

public class Main {
    public static Element getFirstChildWithTagName(Element parent,
            String tagName) {/* w ww .j a va  2 s.com*/
        final NodeList elements = parent.getElementsByTagName(tagName);
        return (elements.getLength() > 0) ? (Element) (elements.item(0))
                : null;
    }
}

Related

  1. getFirstChildText(Node parent)
  2. getFirstChildTextByTagName(Element element, String tagName)
  3. getFirstChildTextContent(Node node)
  4. getFirstChildTextNodeValue(Node node)
  5. getFirstChildTextValue(Element parent, String childName)
  6. getFirstChildWithTagName(Node data, String tagName)
  7. getFirstElement(Element element, String childName)
  8. getFirstElementChild(Element aElement)
  9. getFirstElementChild(Element element)