Here you can find the source of extractTextWithNewlines(Element elem)
public static String extractTextWithNewlines(Element elem)
//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"); } }