JSOUP - 帮助从 <DIV CLASS> 获取 <IMG SRC>

JSOUP - Help getting <IMG SRC> from <DIV CLASS>

我有下面的 HTML 片段。整个文档中有多个 div 类 for "teaser-img"。我希望能够从所有这些 "teaser-img" 类.

中获取所有 "img src"
<div class="teaser-img">
    <a href="/julien/blog/failure-consciousness-vs-success-consciousness-shifting-focus-become-badass-or-loser">
        <img src="http://www.rsdnation.com/files/imagecache/blog_thumbnail/files/blog_thumbs/rsdnatonaustin.jpg" alt="" title=""/>
    </a>
</div>

我尝试了很多东西,所以我不知道要与你们分享什么代码。非常感谢您的帮助。

final String html = "<div class=\"teaser-img\">\n"
        + "    <a href=\"/julien/blog/failure-consciousness-vs-success-consciousness-shifting-focus-become-badass-or-loser\">\n"
        + "        <img src=\"http://www.rsdnation.com/files/imagecache/blog_thumbnail/files/blog_thumbs/rsdnatonaustin.jpg\" alt=\"\" title=\"\"/>\n"
        + "    </a>\n"
        + "</div>";

// Parse the html from string or eg. connect to a website using connect()
Document doc = Jsoup.parseBodyFragment(html);

for( Element element : doc.select("div.teaser-img img[src]") )
{
    System.out.println(element);
}

输出:

<img src="http://www.rsdnation.com/files/imagecache/blog_thumbnail/files/blog_thumbs/rsdnatonaustin.jpg" alt="" title="">

有关选择器语法的文档,请参阅 here