Android XML Node Child Get getChildren(Node node, String name)

Here you can find the source of getChildren(Node node, String name)

Description

get Children

Declaration

public static List<Node> getChildren(Node node, String name) 

Method Source Code

//package com.java2s;

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

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

public class Main {
    public static List<Node> getChildren(Node node, String name) {
        List<Node> children = new ArrayList<Node>();
        NodeList nodes = node.getChildNodes();
        if (nodes != null && nodes.getLength() >= 1) {
            for (int i = 0; i < nodes.getLength(); i++) {
                Node n = nodes.item(i);
                if (name.equals(n.getNodeName())) {
                    children.add(n);/*from   ww w. j a  v  a 2  s .  com*/
                }
            }
        }
        return children;
    }
}

Related

  1. getChildElements(Node node)
  2. getChildElementsByName(Element parent, String name)
  3. getChildNodes(Node node, short type)
  4. getChildTagValue(Node node, String tag)
  5. getChildText(Node n)
  6. getChildren(Node node, String name)
  7. getChildren(Node node, String name)
  8. getChildrenOfName(Node node, String name)
  9. getFirstChild(Node node, String namespace, String name)