简体   繁体   English

使用jsoup提取表的特定单元格

[英]Using jsoup to extract specific cell of table

I am trying to use jsoup to extract specific cell of table. 我正在尝试使用jsoup提取表的特定单元格。 I have this code 我有这个代码

Element vystraha = doc.select("#hzs-table > tbody > tr").get(oblast).select("td").get(1);

"oblast" is set to 0. So if I understand it correctly this should find table (element) with id "hzs-table" then move to its tbody then to first tr (or second if I set "oblast" to 1) and then select second cell of this row. “ oblast”设置为0。因此,如果我正确理解,应该找到ID为“ hzs-table”的表(元素),然后移至其tbody,然后移至第一个tr(如果我将“ oblast”设置为1,则第二个)然后选择该行的第二个单元格。 However compiler shows indexOutOfBounds exception on get(oblast). 但是,编译器在get(oblast)上显示indexOutOfBounds异常。 Table that I am trying to extract is here http://www.hzs.sk/aktualne-informacie/podmienky-na-horach/ 我要提取的表在这里http://www.hzs.sk/aktualne-informacie/podmienky-na-horach/

Thanks in forward 谢谢前进

该表的ID为hzs_table (用下划线而不是减号!)尝试:

Element vystraha = doc.select("#hzs_table > tbody > tr").get(oblast).select("td").get(1);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM