I am parsing html using jsoup and want to extract innerHtml inside of body tag
so far I tried and use document.body.childern().outerHtml; but its giving only html element and skipping floating text(not wrapped within any html tag) inside of body
private String getBodyTag(final Document document) {
return document.body().children().outerHtml();
}
Input:
questions to improve formatting and clarity.
Guided Mode
some sample raw/floating text
Expected:
questions to improve formatting and clarity.
Guided Mode
some sample raw/floating text
Actual:
questions to improve formatting and clarity.
Guided Mode
Answer
Please use this:
private String getBodyTag(final Document document) {
return document.body().html();
}
No comments:
Post a Comment