Java XML Child Get getChildElements(Element element)

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

Description

get Child Elements

License

Apache License

Declaration

public static List<Element> getChildElements(Element element) 

Method Source Code

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

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

import org.w3c.dom.Element;

import org.w3c.dom.NodeList;

public class Main {
    public static List<Element> getChildElements(Element element) {
        List<Element> result = new ArrayList<Element>();
        NodeList childNodes = element.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            if (childNodes.item(i) instanceof Element) {
                result.add((Element) childNodes.item(i));
            }/*from   w  ww.  j ava2  s. co m*/
        }
        return result;
    }
}

Related

  1. getChildElements(Element elem, String name)
  2. getChildElements(Element element)
  3. getChildElements(Element element)
  4. getChildElements(Element element)
  5. getChildElements(Element element)
  6. getChildElements(Element element)
  7. getChildElements(Element element)
  8. getChildElements(Element element)
  9. getChildElements(Element element)