Java HTML Jsoup Element findPreviousHElement(Elements sequence, Element reference)

Here you can find the source of findPreviousHElement(Elements sequence, Element reference)

Description

find Previous H Element

License

Open Source License

Declaration

public static Element findPreviousHElement(Elements sequence, Element reference) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.jsoup.nodes.Element;

import org.jsoup.select.Elements;

public class Main {
    public static Element findPreviousHElement(Elements sequence, Element reference) {
        int index = sequence.indexOf(reference);
        for (index = sequence.indexOf(reference); index >= 0; index--) {
            Element element = sequence.get(index);
            if (element.tagName().startsWith("h")) {
                return element;
            }//from  w ww.  ja  v  a2s  .  com
        }
        return null;
    }
}

Related

  1. findAllNodesBefore(Element firstChapter)
  2. findElementsByTag(Element element, String... tags)
  3. findFirstByTag(Element element, String tag)
  4. findNextElementSibling(final Element startElement, final Predicate condition)
  5. findPreviousH2Element(Element h3)
  6. findRootElement(Element element)
  7. firstElement(final Element element, final String... tags)
  8. getActiveJob(Element element)
  9. getAllNodes(Element element)