如何在Android中解析这个html字符串数据?

时间:2014-07-17 07:04:45

标签: android html parsing

任何人都知道如何解析这个Html String值。

我试过这个人

Document doc = Jsoup.parse(xpp.nextText());
org.jsoup.nodes.Element element = doc.select("src").first();
Log.i("content:encoded is.", "content:encoded ==>"+ element);   

这是html字符串

<p><img class="alignnone" title="Baby one" src="https://i0.wp.com/images4.fanpop.com/image/photos/17400000/Sweet-angel-sweety-babies-17465667-600-399.jpg" alt="Babies" width="600" height="399" />
</p> <p>Test of Baby one here</p> <p><img class="alignnone" title="Baby Two" src="https://i0.wp.com/www.tumblr18.com/t18/2013/10/Cute-pumpkin-baby.jpg" alt="" width="725" height="483" /></p> <p>Test of Baby two here this is important data of baby two</p> 
<p><img class="alignnone" title="Baby Three" src="https://i0.wp.com/i.telegraph.co.uk/multimedia/archive/01778/baby_1778233b.jpg" alt="" width="620" height="388" /></p> <p>Here Third baby details</p><br /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/funnybtesting.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/funnybtesting.wordpress.com/28/" /></a> 

<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=funnybtesting.wordpress.com&#038;blog=71336161&#038;post=28&#038;subd=funnybtesting&#038;ref=&#038;feed=1" width="1" height="1" />

NOTE:除了这样的输出

 title="Baby one" 
 first images src="https://i0.wp.com/images4.fanpop.com/image/photos/17400000/Sweet-angel-sweety-babies-17465667-600-399.jpg"    
 String test = <p>Test of Baby one here</p>

第二

 title="Baby two" 
 second image src="https://i0.wp.com/www.tumblr18.com/t18/2013/10/Cute-pumpkin-baby.jpg"
 String test = Test of Baby two here this is important data of baby two

第三

 title="Baby three" 
 second image src="https://i0.wp.com/i.telegraph.co.uk/multimedia/archive/01778/baby_1778233b.jpg"
 String test = Here Third baby details.

0 个答案:

没有答案