Java XML First Child Element getFirstChildByNodeName(Node parent, String nodeName)

Here you can find the source of getFirstChildByNodeName(Node parent, String nodeName)

Description

get First Child By Node Name

License

Open Source License

Declaration

public static Node getFirstChildByNodeName(Node parent, String nodeName) 

Method Source Code

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

import org.w3c.dom.Node;

public class Main {
    public static Node getFirstChildByNodeName(Node parent, String nodeName) {
        for (Node n = parent.getFirstChild(); n != null; n = n.getNextSibling())
            if (n.getNodeName().equals(nodeName))
                return n;

        return null;
    }/*from   w w w. j a v  a 2  s  .  c om*/
}

Related

  1. getFirstChild(final Element parent, final String childName)
  2. getFirstChild(final Element parentElem, final String childName)
  3. getFirstChild(Node node, String childName)
  4. getFirstChild(Node parent)
  5. getFirstChildByName(Element parent, String name)
  6. getFirstChildByNS(Element node, String ns, String localName)
  7. getFirstChildByRegex(Element ele, String pattern)
  8. getFirstChildByTagName(Element parent, String tagName)
  9. getFirstChildByTagName(Node parent, String tagName)