Java XML Child Node Get getChildNode(Element item, String name)

Here you can find the source of getChildNode(Element item, String name)

Description

get Child Node

License

Open Source License

Declaration

static public Element getChildNode(Element item, String name) 

Method Source Code


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

import org.w3c.dom.*;

public class Main {
    static public Element getChildNode(Element item, String name) {
        NodeList children = item.getChildNodes();

        for (int i = 0; i < children.getLength(); i++) {
            Node thisItem = (Node) children.item(i);
            if (thisItem != null && thisItem.getNodeName().equals(name) && thisItem.getParentNode() == item) {
                return (Element) thisItem;
            }//ww w .j  a v  a  2 s  . com
        }
        return null;
    }
}

Related

  1. getChildElements(Node node)
  2. getChildElements(Node parent)
  3. getChildElements(Node parent)
  4. getChildElements(Node start)
  5. getChildElements(NodeList list)
  6. getChildNode(Node n, String name)
  7. getChildNode(Node n, String name)
  8. getChildNode(Node node, int index)
  9. getChildNode(Node node, String childName)