I want to get just first thing in html.. How to get just first one..?
this is part of HTML file and I used Jsoup in JAVA.
<div class="product-shelf-author contributors">by <a href="/s/%22Carol V. Aebersold%22?
Ntk=P_key_Contributor_List&Ns=P_Sales_Rank&Ntx=mode+matchall">Carol V. Aebersold</a>, <a href="/s/%22
Chanda A. Bell%22?Ntk=P_key_Contributor_List&Ns=P_Sales_Rank&Ntx=mode+matchall"> Chanda A. Bell</a>
</div><div data-bv-show="inline_rating" data-bv-product-id="9780976990703" data-bv-seo="false"></div>
by Carol V. Aebersold , Chanda A. Bell
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Elements writer1 = doc.select("div.product-shelf-author");
Elements writer = writer1.select("a[href]");
if I use this cord in JAVA "Chanaa A.Belll" is aslo added in Elements writer...
but I just want to add just "Carol V.Aebersold" in "Element writer":((
Class Elements
extends ArrayList
, so you can get first element which index is 0.
Elements writer1 = doc.select("div.product-shelf-author");
Elements writer = writer1.select("a[href]");
Element firstElement = writer.get(0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.