tags:

views:

104

answers:

1

Hello

Do you know how to parse images by using rome parser?(java platform) I looked at some samples at rome parser documentation but it's clear. Can you provide me the sample code to parse images by using rome rss parser?

Regards Altaico

A: 

Rome is a RSS parser/generator. As a consequence, it has nothing to do with image parsing. However, if the content of some RSS feed is HTML, then you may consider as a valid extension of Rome the fact of grabbing image content.

As an example, considering this RSS feed item from the magnificient brother bricks site :

<item>
    <title>From the unknown chasms of space</title>
    <link>http://feedproxy.google.com/~r/TheBrothersBrick/~3/8g6XnrwJDlQ/&lt;/link&gt;
    <comments>http://www.brothers-brick.com/2010/08/31/from-the-unknown-chasms-of-space/#comments&lt;/comments&gt;
    <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&lt;/guid&gt;
    <description><![CDATA[&#8230;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>&#8230;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&amp;#038;size=large&gt;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&#8217;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/"&gt;&lt;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&#8217;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/&lt;/wfw:commentRss&gt;
    <slash:comments>0</slash:comments>
    <feedburner:origLink>http://www.brothers-brick.com/2010/08/31/from-the-unknown-chasms-of-space/&lt;/feedburner:origLink&gt;&lt;/item&gt;

You may notice that the content:encoded tag contains one link to a flickr image : http://farm5.static.flickr.com/4084/4946649495_460861bd28.jpg that some RSS clients are able to display as an image. However, it's not because they correctly parse the RSS feed, but rather because, beside being able to interpret correctly the RSS stream, they're able to interpret its content (in this case, some HTML fragment representing the entry to render).

As a consequence, having the ability to download and open image files is NOT a question of RSS parsing, but rather a question of interpreting correctly RSS content, that is NOT RSS per se, but rather encoded CDATA that one is able to understand as valid content, of any form (in this example, HTML).

Riduidel