1) You can select all elements of the document using the * selector.
Elements elements = document.body().select("*");
2) To obtain the text of each individually using the Element.ownText () method.
for (Element element : elements) { System.out.println(element.ownText()); }
3) To change the text of each separately using Element.html (String strHtml). (Cleans up any existing internal HTML in the element and replaces it with parsed HTML.)
element.html(strHtml);
Hope this helps you. Thanks!
Gaurav darji
source share