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

public static ArrayList<Element> getChildElements(Node node) 

Method Source Code


//package com.java2s;

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

import java.util.ArrayList;

public class Main {
    public static ArrayList<Element> getChildElements(Node node) {
        ArrayList<Element> l = new ArrayList<Element>();
        for (Node childNode = node.getFirstChild(); childNode != null;) {
            if (childNode.getNodeType() == Node.ELEMENT_NODE) {
                Element elem = (Element) childNode;
                l.add(elem);/*from www  .jav  a  2  s . co  m*/
            }
            Node nextChild = childNode.getNextSibling();
            childNode = nextChild;
        }

        return l;
    }
}

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)