Here you can find the source of getPreviousTypedNode(Node node, short nodeType)
private static Node getPreviousTypedNode(Node node, short nodeType)
//package com.java2s; import org.w3c.dom.*; public class Main { private static Node getPreviousTypedNode(Node node, short nodeType) { node = node.getPreviousSibling(); while (node != null && node.getNodeType() != nodeType) { node = node.getPreviousSibling(); }/*from ww w.j av a 2 s.co m*/ return node; } private static short getNodeType(Node node) { return (node != null ? node.getNodeType() : -1); } }