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 java.util.ArrayList;
import java.util.List;

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

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);// w  w  w .  j  a v  a 2s .  c  om
                }
            }
        }
        return children;
    }
}

Related

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