Android : Too much content for Jsoup

on Saturday, April 18, 2015


I'm parsing website with Jsoup and I need to get < blockquote > after < b >Фанфики:< /b > (Sorry for Russian). Here is this part of html:



<b>О себе:</b>
<br>
<blockquote class="urlize"></blockquote>
<br>
<b>Контактная информация:</b>
<br>
<blockquote></blockquote>
<br>
<a name="presents"></a>
<b>Подарки и награды:</b>
<br>
<blockquote></blockquote>
<br>
<b>В избранном:</b>
<br>
<blockquote></blockquote>
<br>
<a name="choose"></a>
<hr>
<div class="adblock_warning" style="display: none"></div>
<div style="text-align: center"></div>
<hr>
<div class="center_switcher"></div>
<b>Фанфики:</b>
<blockquote></blockquote>
<div class="paging_next_prev">
<div class="paging_pages">


Problem: When I'm trying to get this element LogCat gives me an Error Caused by: java.lang.IndexOutOfBoundsException: Invalid index 16, size is 16. If I try to check size of children for parrent tag it gives me 16. How can I get needed element if it stays after 16? First i thought that it doesnt see this tags at all, but it doesnt see them when some tags before have too much content and it probably overload my app. Is here any solution to get that part?


Here is example of code how i do that



Element about = document.select("td[style^=padding-left").first();
Elements aaaaa = about.children();
Log.d(String.valueOf(aaaaa.size()),"");


and another one



Element check = document.select("td[style^=padding-left").first();
int i = 0;
boolean aa = true;
Log.d(String.valueOf(aaa.size()),"");
while (aa)
{
Element check = aaa.child(i);
if (check.text().equals("Фанфики:"))
aa = false;
i++;
Log.d("bbbbbbbbbbbbbbbbb","");
}

0 comments:

Post a Comment