code: public static Node findElementByName(String elementName, Node node)
  	{
  
  		if (
  			node == null ||
  			node.getNodeType() == Node.COMMENT_NODE ||
  			node.getNodeType() == Node.TEXT_NODE
  		)
  			return null;
  
  		if (elementName.equals(node.getNodeName()))
  		{
  			return node;
  		}
  
  		NodeList nodeList = node.getChildNodes();
  
  		if (nodeList == null)
  			return null;
  
  		int len = nodeList.getLength();
  
  		Node child;
  
  		for (int i = 0; i < len; i++)
  		{
  			child = nodeList.item(i);
  
  			if (child.getNodeType() == Node.TEXT_NODE)
  				continue;
  
  			if (elementName.equals(child.getNodeName()))
  				return child;
  
  			// check for next
  			NodeList grands = child.getChildNodes();
  			if (grands != null)
  			{
  				int grandsCnt = grands.getLength();
  				for (int x = 0; x < grandsCnt; x++)
  				{
  					Node grandResults = findElementByName(elementName, grands.item(x));
  
  					if (grandResults != null)
  						return grandResults;
  				}
  			}
  		}
  
  		return null;
  	}
docs: ------------------------------------------------