How to avoid surrounding html head tags in Jsoup parse

final String html = "<p><b>This <i>is</i></b> <i>my sentence</i> of text.</p>";

Document docHtml = Jsoup.parse(html);
Document docXml = Jsoup.parse(html, "", Parser.xmlParser());

System.out.println("******* HTML *******
" + docHtml);
System.out.println();
System.out.println("*******  XML *******
" + docXml);
final String html = "<p><b>This <i>is</i></b> <i>my sentence</i> of text.</p>";
Document doc = Jsoup.parseBodyFragment(html);
doc.outputSettings().prettyPrint(false);

System.out.println(doc.body().html());
原文地址:https://www.cnblogs.com/johnsonshu/p/15435445.html