I think that the answer above does not correspond to universality, despite the fact that it offers a resolving direction.
nextSibling() not used when changing the html structure.
When I referenced the Jsoup api, I found a method called textNodes() that can get a list of node text from this element.
public static String getTextAfterTag(Element ele) { String text = ""; for(TextNode node: ele.textNodes()) { text += node.text(); } return text; }
hope to help.
Christopher.Wang
source share