code: static public Element selectParentElement(Element element, String parentName) {
  		Element parentElement = (Element) element.getParentNode();
  		if (parentElement == null) {
  			return null;
  		}
  		if (parentElement.getTagName().equals(parentName)) {
  			return parentElement;
  		}
  		return selectParentElement(parentElement, parentName);
  	}
docs: static XPath xpath = XPathFactory.newInstance().newXPath();