Here you can find the source of toElement(String html)
Parameter | Description |
---|---|
html | the HTML |
public static Element toElement(String html)
//package com.java2s; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; public class Main { /**/* w w w . ja v a 2 s . c o m*/ * Converts an HTML string to an HTML element. * @param html the HTML * @return the HTML element */ public static Element toElement(String html) { return toElement(html, null); } /** * Converts an HTML string to an HTML element. * @param html the HTML * @param baseUrl the base URL * @return the HTML element */ public static Element toElement(String html, String baseUrl) { Document d = (baseUrl == null) ? Jsoup.parse(html) : Jsoup.parse(html, baseUrl); return d.getElementsByTag("body").first().children().first(); } }