Java XML First Child Element getFirstElementChild(Element element)

Here you can find the source of getFirstElementChild(Element element)

Description

get First Element Child

License

Apache License

Declaration

public static Element getFirstElementChild(Element element) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Element;

import org.w3c.dom.Node;

public class Main {
    public static Element getFirstElementChild(Element element) {
        Node child = element.getFirstChild();

        while (child != null) {
            if (child.getNodeType() == Node.ELEMENT_NODE)
                return (Element) child;

            child = child.getNextSibling();
        }//from w ww.j a v a2 s .c o  m
        return null;
    }
}

Related

  1. getFirstChildTextValue(Element parent, String childName)
  2. getFirstChildWithTagName(Element parent, String tagName)
  3. getFirstChildWithTagName(Node data, String tagName)
  4. getFirstElement(Element element, String childName)
  5. getFirstElementChild(Element aElement)
  6. getFirstElementChild(Element elemNode)
  7. getFirstElementChild(Element elemNode)
  8. getFirstElementChild(Element parent)
  9. GetFirstElementChild(Element tag)