java - Jsoup recove text from div without selector -
i have html code
<div itemprop="doseschedule"> text1 </div> <h3><a id="sp3">title</a></h3> <div>text2</div> <div itemprop="warning"> text3 </div>
and try recover text2, can't still. how can it?
this code want:
public class jsouptest { public static void main(string[] args) throws ioexception { string html = "<div itemprop=\"doseschedule\">\n" + "text1\n" + "</div>\n" + "<h3><a id=\"sp3\">title</a></h3>\n" + "<div>text2</div>\n" + "<div itemprop=\"warning\">\n" + "text3\n" + "</div>"; document doc = jsoup.parse(html); element e = doc.select("h3").first().nextelementsibling(); system.out.println(e.text()); } }
Comments
Post a Comment