开发者

Select by "name" in JSoup

I have multiple div's in a webpage URL that I have to parse which have the same class name but different names with no id's.

for eg.

<div class="answer" style="display: block;" name="yyy" oldblo开发者_StackOverflow中文版ck="block" jQuery1317140119108="11"> 

and

<div class="answer" style="display: block;" name="xxx" oldblock="block" jQuery1317140119108="11">

I want to select data and parse from only one of the div's say namely (name="yyy") (the content inside the div's are <href> links which differ for each class.

I've looked up the selector syntax in the Jsoup webpage but can't get a way to work around it. Can you please help me with this or let me know if I'm missing something?


Use the [attributename=attributevalue] selector.

Elements xxxDivs = document.select("div.answer[name=xxx]");
// ...

Elements yyyDivs = document.select("div.answer[name=yyy]");
// ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜