Java tutorial
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node GetSimpleTagNode(Document doc, String tag) { NodeList nList2 = doc.getElementsByTagName(tag); for (int temp = 0; temp < nList2.getLength(); temp++) { Node nNode2 = nList2.item(temp); if (nNode2.getNodeType() == Node.ELEMENT_NODE) { return nNode2; } // end if nnode.getnodetype() } //end for int temp return null; } }