我正在研究this link以提取div(价格)中的一些文本,但我有一个问题,如果有重复的文本,它将只打印一次!
这是我的代码
doc = Jsoup.connect("http://deals.souq.com/sa-ar/?id_tag=48&pid_tag=103").get();
System.out.println(doc.select("div").select("div.txt28") );
输出应该像这样
<div class="text-black txt28 arial mart-10">
85
<span class="txt16"><b>ريـال</b></span>
</div>
<div class="align-c text-black txt28">
599
<span class="txt16"><b> ريـال</b></span>
</div>
<div class="align-c text-black txt28">
444
<span class="txt16"><b> ريـال</b></span>
</div>
** <div class="align-c text-black txt28">
388
<div class="align-c text-black txt28">
388
但输出显示给我(388只打印一次)
<div class="text-black txt28 arial mart-10">
85
<span class="txt16"><b>ريـال</b></span>
</div>
<div class="align-c text-black txt28">
599
<span class="txt16"><b> ريـال</b></span>
</div>
<div class="align-c text-black txt28">
444
<span class="txt16"><b> ريـال</b></span>
</div>
<div class="align-c text-black txt28">
388
<span class="txt16"><b> ريـال</b></span>
</div>
<div class="align-c text-black txt28">
399
答案 0 :(得分:0)
你的选择器似乎错了。试试这个
doc = Jsoup.connect("http://deals.souq.com/sa-ar/?id_tag=48&pid_tag=103").get();
System.out.println(doc.select("div.txt28") );