LoginSignup
1
1

More than 5 years have passed since last update.

jsoup selectorで複数クラスが割り当てられている要素を取得

Last updated at Posted at 2015-04-16

例えば下記のfooだけを取得したい場合

<td class="hoge1">hoge</td>
<td class="hoge1 hoge2">foo</td>

Elements elem = document.select("td.hoge1");
ではどちらの要素も取得してしまう
なのでfooだけを取得したい場合は
Elements elem = document.select("td.hoge1.hoge2");
という風にクラスをすべて書くとfooの要素だけ取得できる

そんなにむつかしいことではないが、メモメモ
(参考:http://jsoup.org/apidocs/org/jsoup/select/Selector.html)

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1