<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标签和输入隐藏标签之间没有容器。如何通过标记获取元素+使用选择器的第5个值
我试图2ways但他们返回惟独第一个值
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+")");
}
该HTML无效。你不能把输入元素放在你有的地方。 – Rob
为什么不使用className或ID? – kiro112
该HTML无效? 0_0我想学习HTML解析,所以我试着从互联网购物商场解析信息。 :(...在这个页面中,#productform(fomtag)有这个表格,我很乐意提供你的建议,我更喜欢:) http://www.lottemart.com/search/search.do?searchField= &searchTerm =%EA%B0%90%EC%9E%90&viewType = list – prepare123