Here you can find the source of getLastChildElement(Node node)
public static Element getLastChildElement(Node node)
//package com.java2s; import org.w3c.dom.Node; import org.w3c.dom.Element; public class Main { public static Element getLastChildElement(Node node) { Node child = node.getLastChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { return (Element) child; }//from w w w.j a v a 2s. c o m child = child.getPreviousSibling(); } return null; } }