Exemplo n.º 1
0
 static boolean preserveWhitespace(Node node) {
   // looks only at this element and one level up, to prevent recursion & needless stack searches
   if (node != null && node instanceof Element) {
     Element element = (Element) node;
     return element.tag.preserveWhitespace()
         || element.parent() != null && element.parent().tag.preserveWhitespace();
   }
   return false;
 }
Exemplo n.º 2
0
 private static void accumulateParents(Element el, Elements parents) {
   Element parent = el.parent();
   if (parent != null && !parent.tagName().equals("#root")) {
     parents.add(parent);
     accumulateParents(parent, parents);
   }
 }