Java HTML Jsoup Element extractTextWithNewlines(Element elem)

Here you can find the source of extractTextWithNewlines(Element elem)

Description

Extracts text from Element, replacing
with newline.

License

Open Source License

Declaration

public static String extractTextWithNewlines(Element elem) 

Method Source Code

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

import org.jsoup.nodes.Element;

public class Main {
    private static final String LINE_SEPARATOR = "--------------PLACEHOLDER-----------";

    /**/*from  w w w . ja v a2  s .  c  om*/
     * Extracts text from Element, replacing {@code <br>} with newline.
     */
    public static String extractTextWithNewlines(Element elem) {
        elem.select("br").html(LINE_SEPARATOR);
        return elem.text().replace(LINE_SEPARATOR, "\n");
    }
}

Related

  1. convertTablesToDivs(Element body)
  2. copy(Element e)
  3. countElements(Node parent)
  4. createSafeElement(Element sourceEl)
  5. elementsToList(Elements elements)
  6. filterElementsByTag(List results, Element element, Set tagSet)
  7. findAElementsWithId(Elements elements, String id)
  8. findAllNodesBefore(Element firstChapter)
  9. findElementsByTag(Element element, String... tags)