<table>
<tbody>
I WANT it => <input type="hidden" name="prodCd_8801043014830" id="prodCd_8801043014830" value="8801043014830">
<input type="hidden" name="itemCd_8801043014830" id="itemCd_8801043014830" value="001">
<input type="hidden" name="categoryId_8801043014830" id="categoryId_8801043014830" value="C001001700010001">
<input type="hidden" name="maxQty_8801043014830" id="maxQty_8801043014830" value="20">
<input type="hidden" name="minQty_8801043014830" id="minQty_8801043014830" value="1">
<tr>
<-- CONTENTS-->
</tr>
I WANT it => <input type="hidden" name="prodCd_8801043015738" id="prodCd_8801043015738" value="8801043015738">
<input type="hidden" name="itemCd_8801043015738" id="itemCd_8801043015738" value="001">
<input type="hidden" name="categoryId_8801043015738" id="categoryId_8801043015738" value="C001001700010004">
<input type="hidden" name="maxQty_8801043015738" id="maxQty_8801043015738" value="31">
<input type="hidden" name="minQty_8801043015738" id="minQty_8801043015738" value="1">
<tr>
<-- CONTENTS-->
</tr>
HI我希望获取第一个元素和1 + 5n个输入隐藏标记值。隐藏标签组TR标签和输入隐藏标签之间没有容器。
我尝试了2路,但除了第一个值
外,它们返回错误的值Document doc=Jsoup.connect("URL").timeout(5000).get();
a is integer value
for(int a=0;a<10;a++){
int n = 0+5a
1.Elements testattrval =
doc.select("table tbody input[type=hidden]:eq("+n+")");
2.Elements testattrval = doc.select("table tbody input[type=hidden]:nth-child(+"n+")");
}