Java XML First Child Element getFirstChildElement(Element element)

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

Description

get First Child Element

License

Open Source License

Declaration

public static Element getFirstChildElement(Element element) 

Method Source Code

//package com.java2s;
/*/*  w w  w  .j  a v  a  2  s.  c  o m*/
 * This file is part of Dorado 7.x (http://dorado7.bsdn.org).
 * 
 * Copyright (c) 2002-2012 BSTEK Corp. All rights reserved.
 * 
 * This file is dual-licensed under the AGPLv3 (http://www.gnu.org/licenses/agpl-3.0.html) 
 * and BSDN commercial (http://www.bsdn.org/licenses) licenses.
 * 
 * If you are unsure which license is appropriate for your use, please contact the sales department
 * at http://www.bstek.com/contact.
 */

import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class Main {

    public static Element getFirstChildElement(Element element) {
        Node childNode = element.getFirstChild();
        while (childNode != null) {
            if (childNode instanceof Element) {
                return (Element) childNode;
            }
            childNode = childNode.getNextSibling();
        }
        return null;
    }
}

Related

  1. getFirstChildElement(Element elem)
  2. getFirstChildElement(Element elem)
  3. getFirstChildElement(Element elem)
  4. getFirstChildElement(Element element)
  5. getFirstChildElement(Element element)
  6. getFirstChildElement(Element element)
  7. getFirstChildElement(Element element)
  8. getFirstChildElement(Element element, String namespaceURI, String tagName)
  9. getFirstChildElement(Element elm, String name)