【发布时间】:2012-12-19 14:49:42
【问题描述】:
我想使用 jsoup 从 url List of cities and towns in India 中提取所有城市名称和州名称,下面给出了该页面的 HTML 代码 sn-p。
这里 Abhaypuri 是一个城市的名称,Assam 是一个州的名称。类似的城市和州名也在页面中多次出现在这种出现数千次的表结构中,除了 td 标记内的 url 之外,其他一切都相同。
<table class="wikitable sortable" style="text-align:;">
<tr>
<th>Name of City/Town</th>
<th>Name of State</th>
<th>Classification<pre><code></th>
<th>Population (2001)<pre><code></th>
<th>Population (2011)<pre><code></th>
</tr>
<tr>
<td><pre><code><a href="/wiki/Abhayapuri" title="Abhayapuri">Abhayapuri<pre><code></a><pre><code></td>
<td><pre><code><a href="/wiki/Assam" title="Assam">Assam<pre><code></a><pre><code></td>
我是 jsoup 的新手。任何帮助,将不胜感激。谢谢。
【问题讨论】:
标签: java html-parsing jsoup