我需要将客户的表数据存储到数据库中。
有n个表没有提供任何表类(直接在网页中直接使用Table_id)。
例子:
[table width="100%" border="0" cellpadding="0" cellspacing="0" id="AutoNumber5" style="border-collapse: collapse" bordercolor="#111111"]<br/>
[table width="100%" border="0" cellpadding="0" cellspacing="0" id="AutoNumber4" style="border-collapse: collapse" bordercolor="#111111" ]
如果有一个表类,显然我可以很容易地解析它,但是没有类只是在表中给出了 id。
我知道只有一个单词语法,除了
for (Element table : doc.select("table")
也许我找不到它。如何找到它? 我试过了
for (Element table : doc.select("table.AutoNumber5")
但这对我不起作用。
如何解决这个问题?
最佳答案
试试这个
doc.select("table#AutoNumber5");
它对我有用。
关于java - 如何在java中使用JSoup通过表id解析html表数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20393251/