Android XML Node Child Get getChildElements(Node node)

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

Description

get Child Elements

Declaration

public static Collection getChildElements(Node node) 

Method Source Code

//package com.java2s;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static Collection getChildElements(Node node) {
        List elements = new ArrayList();
        NodeList nodes = node.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            Node childNode = nodes.item(i);
            if (childNode instanceof Element) {
                elements.add(childNode);
            }//w ww.  ja v a  2  s.  c  om
        }
        return elements;
    }
}

Related

  1. getChild(Node node, String tag)
  2. getChildElement(Node element, String childNodeName)
  3. getChildElement(Node element, String childNodeName)
  4. getChildElementText(Node element, String childNodeName)
  5. getChildElementText(Node element, String childNodeName)
  6. getChildElementsByName(Element parent, String name)
  7. getChildNodes(Node node, short type)
  8. getChildTagValue(Node node, String tag)
  9. getChildText(Node n)