Java tutorial
//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; NodeList nodes = document.getElementsByTagName(tagName); if (nodes.getLength() > 0) foundNode = nodes.item(0); return foundNode; } }