您是否知道如何使用羅密解析器解析圖像?(java平臺)我在羅馬解析器文檔中查看了一些示例,但很明顯。你能否通過使用rome rss解析器提供示例代碼來解析圖像?如何使用羅馬解析圖像RSS解析器
問候 Altaico
您是否知道如何使用羅密解析器解析圖像?(java平臺)我在羅馬解析器文檔中查看了一些示例,但很明顯。你能否通過使用rome rss解析器提供示例代碼來解析圖像?如何使用羅馬解析圖像RSS解析器
問候 Altaico
羅馬是一個RSS解析器/發電機。因此,它與圖像解析無關。但是,如果某個RSS源的內容是HTML,那麼您可以將其視爲羅馬的有效擴展,即抓取圖像內容。
作爲一個例子,考慮從宏偉的brother bricks網站這個RSS Feed項目:
<item>
<title>From the unknown chasms of space</title>
<link>http://feedproxy.google.com/~r/TheBrothersBrick/~3/8g6XnrwJDlQ/</link>
<comments>http://www.brothers-brick.com/2010/08/31/from-the-unknown-chasms-of-space/#comments</comments>
<pubDate>Wed, 01 Sep 2010 04:20:49 +0000</pubDate>
<dc:creator>Nannan</dc:creator>
<category><![CDATA[LEGO]]></category>
<category><![CDATA[Our Own Creations]]></category>
<category><![CDATA[Space]]></category>
<guid isPermaLink="false">http://www.brothers-brick.com/?p=16929</guid>
<description><![CDATA[…comes my latest creation, a ship called Broken Regret. I strove for an ominous and organic looking craft by incorporating curves and spikes (best viewed on black). The result is something that looks much better in real life than on photos. This is due to the curves of the ship distorting our perception of its [...]]]></description>
<content:encoded><![CDATA[<p>…comes my latest creation, a ship called Broken Regret. I strove for an ominous and organic looking craft by incorporating curves and spikes (best <a href=http://bighugelabs.com/onblack.php?id=4946649495&size=large>viewed on black</a>). The result is something that looks much better in real life than on photos. This is due to the curves of the ship distorting our perception of its true shape and size (I had to do a lot of lens adjustments in Photoshop). Hopefully you’ll see what I mean when I post more pictures and a video in the upcoming days.</p>
<p><a href="http://www.flickr.com/photos/nannanz/4946649495/"><img src="http://farm5.static.flickr.com/4084/4946649495_460861bd28.jpg" width="500"></a></p>
<p>On another note, I want to mention that there are some incredible sellers on Bricklink who sent me last-minute parts to complete the ship at practically no cost. I’ve encountered many of you over the years, you know who you are, thank you.</p>
<img src="http://feeds.feedburner.com/~r/TheBrothersBrick/~4/8g6XnrwJDlQ" height="1" width="1"/>]]></content:encoded>
<wfw:commentRss>http://www.brothers-brick.com/2010/08/31/from-the-unknown-chasms-of-space/feed/</wfw:commentRss>
<slash:comments>0</slash:comments>
<feedburner:origLink>http://www.brothers-brick.com/2010/08/31/from-the-unknown-chasms-of-space/</feedburner:origLink></item>
您可能會注意到內容:編碼標籤包含一個鏈接到Flickr的圖像:http://farm5.static.flickr.com/4084/4946649495_460861bd28.jpg
,一些RSS客戶端能夠顯示爲圖像。然而,這並不是因爲他們正確地解析RSS提要,而是因爲除了能夠正確解釋RSS流之外,他們還能夠解釋其內容(在這種情況下,表示要呈現的條目的某個HTML片段)。因此,具有下載和打開圖像文件的能力不是RSS解析的問題,而是正確解釋RSS內容的問題,這不是RSS本身,而是編碼的CDATA,一個是能夠解析的理解爲任何形式的有效內容(在本例中爲HTML)。
你看到圖像的URL在標籤中。 所以試着在你的程序中解析這個標籤(只需在解析標題,pubDate,鏈接等處添加另一個標籤)。 然後創建一個methot getContent將標記中的所有內容保存在一個String中。 並從那裏只是做一個StringTokenizer的,讓您的圖片鏈接(選擇分隔符\」)
你得到URL後,下載
搜索圖片供下載的位圖RSS,你會發現如何下載與位圖和程序
請添加國稅發要解析RSS一些實例繪製圖像,這是不完全清楚你的圖片,外殼,HTML內容或媒體RSS是什麼意思。 – 2010-09-01 13:30:56