无法从Element Jsoup中提取文本

时间:2015-06-23 01:46:02

标签: java jsoup element

为什么我不能从这个元素中获取文本?

Elements el = doc.select("#Core_UI_AutogeneratedID_0 > fieldset:nth-child(1) > p:nth-child(23)");
for (Element e : el) {
      System.out.println(e.text());
}

我正在连接到网站,这就是问题

Elements el = doc.select("#Core_UI_AutogeneratedID_0 > fieldset:nth-child(1) > p:nth-child(23)");

我如何打印元素?

HTML格式:

<div class="Content">
<fieldset class="TableLike FixedLabelSmall Narrow">

    <label>Age:</label>
    <p class="Value" title="9 d 21 h ">9 d 21 h </p>
    <div class="Clear"></div>

    <label>Created:</label>
    <p class="Value" title="06/13/2015 11:10">06/13/2015 11:10</p>
    <div class="Clear"></div>


    <label>State:</label>
    <p class="Value" title="closed successful">closed successful</p>
    <div class="Clear"></div>

    <label>Locked:</label>
    <p class="Value" title="unlock">unlock</p>
    <div class="Clear"></div>

    <label>Priority:</label>
    <p class="Value" title="3 normal">3 normal</p>
    <div class="Clear"></div>

    <label>Queue:</label>
    <p class="Value" title="Sydney">Sydney </p>
    <div class="Clear"></div>

    <label>Service:</label>
    <p class="Value" title="SUV">SUV</p>
    <div class="Clear"></div>
    <label>Service Level Agreement:</label>
    <p class="Value" title="**I WANT THIS TEXT**">Sydney SLA</p>
    <div class="Clear"></div>

</fieldset>

0 个答案:

没有答案