简体   繁体   English

jsoup标签提取

[英]jsoup tag extraction

how can extract the tag from this html 如何从此html中提取标签

<dl>
<dt>test:</dt>
    <dd id="rating" class="">+0 / -0 (0)</dd>
<dt>up:</dt>
    <dd>GMT</dd>
<dt>By:</dt>
    <dd></dd>
<dt>example:</dt>
    <dd>5</dd>
<dt>file:</dt>
    <dd>8</dd>
</dl>

how can i extract the 5 and 8 in this html code using jsoup....please help me 我如何使用jsoup提取此html代码中的5和8。...请帮助我

doc.select("dt:contains(example) + dd")

Would select the dd containing "5". 将选择包含“ 5”的dd。 The complete syntax is available here . 完整的语法在这里可用。

doc.select("dt:contains(example) + dd").first().text()

Would be the 5 itself. 将是5本身。

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

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