Jsoup - getting class element with whitespace in name

kincaid picture kincaid · Jan 28, 2013 · Viewed 10.7k times · Source

I am trying to grab the value of this class by tag "c2 l n".

<td class="c2 l n"><span class"generic">0,63</span></td>

In Jsoup i have tried this :

String value="c2 l n";
Elements Stock_Data_Change = doc.getElementsByClass(value);

But it keeps coming up empty.. it works fine with other classnames such as "ju.l", it seems to miss the whitespaces. Anyone know a solution for this?

Answer

kincaid picture kincaid · Jan 29, 2013

As Dave Newton answered in comments above, we are talking about elements,that has multiple classes in them. To get the value of this element, this single line grabs it for me.

Element Stock_Data_Change = doc.select("td.c2.l.n");