0

Alright I am having trouble with finding an equivalent of Element.children() because I have an Elements object... What I am trying to do is download an html file (well I have done that...) and identify a single table row (, I've done that by using doc.getElementsByClass("emphasizedRowColor"); because the row I want has that emphasizedRowColor class and no other elements do). I just don't understand how to isolate the one Element in my Elements object RWTableRow. Html:

<tr class="rwOdd emphasizedRowColor">
<td class="jewel" style="">
<div class="teamJewel" style="background-position: 0px -336px;margin: 0 0 2px 2px;"></div>
</td>
<td class="left" style=""> Detroit</td>
<td style="">18</td>
<td style="">9</td>
<td style="">5</td>
<td style="">4</td>
<td class="narrowStatsColumn cSrt" style="">22</td>
<td class="narrowStatsColumn" style="">9</td>
<td style="">45</td>
<td style="">48</td>
<td style="">3-2-4</td>
<td style="">6-3-0</td>
<td style="">3-3-4</td>
</tr>

I can figure out what to do once I actually get the table as an Element but oh boy I think I just need a fresh set of eyes to figure out what I'm doing...

Java:

Document doc = Jsoup.connect(url).userAgent("Mozilla").get(); 
Elements RWTableRow = doc.getElementsByClass("emphasizedRowColor");

As you can see, I'm in quite the pickle...

4

1 に答える 1

1

Elementsは標準java.util.Listであり、単に呼び出すことができます

 Element e = RWTableRow.get(0);

そして、あなたはそれを持っています。

于 2013-11-13T18:40:14.220 に答える