I use jsoup-1.6.0,parse html tag string, that only include string content “0”, but jsoup return null, I understand…
examply:
String html = "<span>0</span>";
Document doc = Jsoup.parse(html);
Elements eles = doc.getElementsByTag("span");
Element span = eles.get(0);
System.out.println(span.hasText());//false
System.out.println(span.ownText());//null, but I hope the result is "0"
It’s why?
Answer:
It should be a bug, binary_runner says jsoup-1.3.3 works well, I test jsoup-1.5.2 works well too. so, I decide use jsoup-1.5.2 .
Thanks binary_runner!
This is a bug in jsoup
1.6.0caused by an incorrect null check in the new HTML parser implementation.I have fixed the issue and it will be available in
1.6.1, which I’ll in the next couple of days.