Java XML Child Node Get getChildElements(Node node)

Here you can find the source of getChildElements(Node node)

Description

get Child Elements

License

Open Source License

Declaration

static public List<Element> getChildElements(Node node) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;

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

import org.w3c.dom.Element;

public class Main {
    static public List<Element> getChildElements(Node node) {
        ArrayList<Element> list = new ArrayList<Element>();
        NodeList nl = node.getChildNodes();
        for (int i = 0; i < nl.getLength(); i++) {
            Node n = nl.item(i);//from  w  w w.  ja  va 2  s.c  o m
            if (n.getNodeType() == Node.ELEMENT_NODE) {
                list.add((Element) nl.item(i));
            }
        }
        return list;
    }
}

Related

  1. getChildElements(Node node)
  2. getChildElements(Node node)
  3. getChildElements(Node node)
  4. getChildElements(Node node)
  5. getChildElements(Node node)
  6. getChildElements(Node node)
  7. getChildElements(Node node)
  8. getChildElements(Node node)
  9. getChildElements(Node node)