protected void indent(Appendable accum, int depth, Document.OutputSettings out) throws IOException { accum.append('\n').append(StringUtil.padding(depth * out.indentAmount())); }
/** * Writes the given jsoup document to the output stream (in UTF-8) * * @param doc * the document to write * @param outputStream * the stream to write to * @throws IOException * if writing fails */ private static void write(Document doc, OutputStream outputStream) throws IOException { doc.outputSettings().indentAmount(4); doc.outputSettings().syntax(Syntax.html); doc.outputSettings().prettyPrint(true); outputStream.write(doc.html().getBytes(UTF_8)); }
doc.outputSettings().indentAmount(4); return doc.toString();
doc.outputSettings().indentAmount(4); return doc.toString();
Document document = Jsoup.parseBodyFragment("<" + XHTMLBODYROOT + ">" + xhtmlField + "</" + XHTMLBODYROOT + ">"); document.outputSettings().indentAmount(0).prettyPrint(false);
public static String prettyPrint(String ugly) { Document doc = Jsoup.parseBodyFragment(ugly); doc.outputSettings().indentAmount(2); return doc.body().html(); }
public static String toCompactString(Document document) { document.outputSettings() .prettyPrint(false) .indentAmount(0); return document.html(); } }