Java XML Child Node Get getChildNode(Node parentNode, String childElementName)

Here you can find the source of getChildNode(Node parentNode, String childElementName)

Description

get Child Node

License

Apache License

Declaration

public static Node getChildNode(Node parentNode, String childElementName) 

Method Source Code

//package com.java2s;
// Licensed to the Apache Software Foundation (ASF) under one

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

public class Main {
    public static Node getChildNode(Node parentNode, String childElementName) {
        NodeList l = parentNode.getChildNodes();
        for (int i = 0; i < l.getLength(); i++) {
            Node node = l.item(i);
            if (node.getNodeName().equals(childElementName))
                return node;
        }//from   ww w .java  2 s.co  m
        return null;
    }
}

Related

  1. getChildNode(Node node, String name)
  2. getChildNode(Node node, String nodeName)
  3. getChildNode(Node node, String tag)
  4. getChildNode(Node parent, String childName)
  5. getChildNode(Node parent, String tagName)
  6. getChildNode(Node root, String childName)
  7. getChildNode(Node rootNode, String childName)
  8. getChildNodeByLocalName(final Node parentNode, final String localNodeName)
  9. getChildNodeByName(final Node xnode, final String name, final boolean caseSensitive)