Java XML Child Node Get getChildNodeByName(Node node, String childName)

Here you can find the source of getChildNodeByName(Node node, String childName)

Description

get Child Node By Name

License

Apache License

Declaration

public static Node getChildNodeByName(Node node, String childName) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static Node getChildNodeByName(Node node, String childName) {
        NodeList children = node.getChildNodes();
        for (int j = 0; j < children.getLength(); j++) {
            Node child = children.item(j);
            if (child.getNodeName().equals(childName)) {
                return child;
            }//  w w w  .  ja v a 2s .co  m
        }
        return null;
    }
}

Related

  1. getChildNode(Node root, String childName)
  2. getChildNode(Node rootNode, String childName)
  3. getChildNodeByLocalName(final Node parentNode, final String localNodeName)
  4. getChildNodeByName(final Node xnode, final String name, final boolean caseSensitive)
  5. getChildNodeByName(Node element, CharSequence nodeName, boolean caseSensitive)
  6. getChildNodeByName(Node node, String name)
  7. getChildNodeByTagName(Node node, String name)
  8. getChildNodeByType(Element element, short nodeType)
  9. getChildNodeGentle(Node node, String namespace, String localname)