Here you can find the source of getChildNode(Node node, String name)
Parameter | Description |
---|---|
node | The node to search children of |
name | The name of the node to search for, case-sensitive. |
public static Node getChildNode(Node node, String name)
//package com.java2s; import org.w3c.dom.Node; public class Main { /**/* w w w . ja va 2 s . c om*/ * Returns the first XML child tag with the specified name. * * @param node The node to search children of * @param name The name of the node to search for, case-sensitive. * @return The child with the specified name, or null if none exists. */ public static Node getChildNode(Node node, String name) { Node child = node.getFirstChild(); while (child != null) { if (child.getNodeName().equals(name)) { return child; } child = child.getNextSibling(); } return null; } }