Java XML First Child Element getFirstElementChild(final Node node)

Here you can find the source of getFirstElementChild(final Node node)

Description

get First Element Child

License

Apache License

Declaration

public static Element getFirstElementChild(final Node node) 

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(final Node node) {

        Element elem = null;/* ww w . j  av a2  s .c  o  m*/
        for (Node childNode = node.getFirstChild(); childNode != null; childNode = childNode.getNextSibling()) {
            if (childNode.getNodeType() == Node.ELEMENT_NODE) {
                elem = (Element) childNode;
                return elem;
            }
        }
        return elem;

    }
}

Related

  1. getFirstElementChild(Element elemNode)
  2. getFirstElementChild(Element parent)
  3. GetFirstElementChild(Element tag)
  4. getFirstElementChild(final Element element, final String namespace, final String localname)
  5. getFirstElementChild(final Node node)
  6. getFirstElementChild(Node root)
  7. getFirstElementContent(Element element, String childName)
  8. getFirstElemText(Element parent, String childName)
  9. getFirstLevelChildElementByTagName(Element parent, String elementName)