Here you can find the source of toHtmlByHtml(String html)
input:The output, can managing by #newOutputSetting(Document.OutputSettings)I amoutput:Java
programmerI amJava
programmer
Parameter | Description |
---|---|
html | input html |
public static Element toHtmlByHtml(String html)
//package com.java2s; //License from project: Open Source License import org.jsoup.nodes.Element; public class Main { /**//from ww w . j a v a 2s .c om * insert html tag in the top <br> * <b>Beware</b>: It's include head and body tag too * <pre>{@code * input: <div>I am <code>Java</code> programmer</div> * output: * <html> * <head></head> * <body> * <div>I am <code>Java</code> programmer</div> * </body> * </html> * }</pre> * <b>The output, can managing by {@link #newOutputSetting(Document.OutputSettings)}</b> * * @param html * input html * @return input with html, body and head tag */ public static Element toHtmlByHtml(String html) { return new Element("html").append(html); } }