Here you can find the source of findNodeByTagName(Document document, String tagName)
public static Node findNodeByTagName(Document document, String tagName)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node findNodeByTagName(Document document, String tagName) { Node foundNode = null;/*from www. j a va 2s. c o m*/ NodeList nodes = document.getElementsByTagName(tagName); if (nodes.getLength() > 0) foundNode = nodes.item(0); return foundNode; } }