How to parse elements with only one class name included in Jsoup?
For this html:
<div id="list">
<div class="one two three" date="20130121">
...
</div>
<div class="one" date="20130122">
...
</div>
<div class="one two" date="20130123">
...
</div>
<div class="one" date="20130124">
...
</div>
</div>
I would like to extract the date element with only class = "one"
, so if a class is included "one" but has a different class, it is not. My pending response should be date="20130122"
anddate="20130124"
I tried using:
Element outestDiv = doc.getElementById("list");
Elements eachDayBox = outestDiv.select("div.one");
But eachDayBox.size()
return 4, but not 2. So how to extract only "one" with the class? Also, how do I get the item in "date" ??
+3
source to share