【发布时间】:2014-03-26 00:21:28
【问题描述】:
大家好,我正在尝试解析来自本网站 http://feed43.com/alytus_06.xml 的标题文本。
html代码:
<html>
<head></head>
<body onload="doLoad()">
<div class="body feed-preview">
<table class="main" style="margin-top:10px">...</table>
<div class ="main">
<h1>ALYTUS_06</h1>
<p>ALYTUS_06</p>
<p>...</p>
<p class="date-preview" style="margin-bottom:0px;">Last Updated: Mon, 24 Feb 2014 10:01:54 GMT</p>
</div>
<div class ="main">
<h2>
<span class="bullet"> </span>
"-1"
</h2>
<div class="p" id="item_1">...</div>
<h2>..</h2>
<div class="p" id="item_2">...</div>
</div>
<div class="main footer">
Feed43 v. 1.3. Copyright © 2006–2011 A.I.Studio. All rights reserved.
</div>
</div>
</body>
public static void main( String[] args ) throws IOException
{
Document doc = Jsoup.parse("UTF-8", "http://feed43.com/alytus_06.xml");
for (Element e : doc.select("h2")) {
System.out.println(e.text());
}
}
我无法从这段代码中的 h2 中的 div.class main 中提取温度“-1”,也许有人可以帮助我?
【问题讨论】:
-
你的程序打印出什么?
标签: java html parsing dom jsoup