Java XML Child Get getChildElements(Element element)

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

Description

get Child Elements

License

Open Source License

Declaration

public static List<Element> getChildElements(Element element) 

Method Source Code

//package com.java2s;
/**//from  ww  w.  ja va2s . c o  m
 * This file belongs to the BPELUnit utility and Eclipse plugin set. See enclosed
 * license file for more information.
 */

import java.util.ArrayList;
import java.util.List;

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

public class Main {
    public static List<Element> getChildElements(Element element) {
        NodeList childNodes = element.getChildNodes();

        List<Element> elements = new ArrayList<Element>();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node n = childNodes.item(i);
            if (n instanceof Element) {
                elements.add((Element) n);
            }
        }
        return elements;
    }
}

Related

  1. getChildElements(Element element)
  2. getChildElements(Element element)
  3. getChildElements(Element element)
  4. getChildElements(Element element)
  5. getChildElements(Element element)
  6. getChildElements(Element parent)
  7. getChildElements(Element parent)
  8. getChildElements(Element parent)
  9. getChildElements(Element parent)