PDA

View Full Version : Why does my RSS Reader is buggy for some RSS ?


1somniac
09-09-2007, 10:56 PM
Hi,


I am trying build an RSS reader from an adobe tutorial (http://labs.adobe.com/wiki/index.php/AIR:Articles:Building_Your_First_Flex-based_Adobe_AIR_Application). This reader can read the RSS given by adobe works as example, but most of the RSS doesn't and I don't know why.

Here is the code in my Main file
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[

import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;

[Bindable] private var rssFeedData:ArrayCollection;
private function rssHandler(event:ResultEvent):void
{
rssFeedData = event.result.RDF.item;
}
]]>
</mx:Script>
<mx:HTTPService id="RssService" url="http://weblogs.macromedia.com/mxna/xml/rss.cfm?query=byMostRecent"
result="rssHandler(event)"/>


<!--For displaying data -->

<mx:TabNavigator
id="ContentNavigator"
width="860" height="540"
x="10" y="10" paddingTop="5" paddingRight="5" paddingBottom="5" paddingLeft="5">

<mx:VBox label="Articles"
width="100%" height="100%"
verticalGap="0" paddingTop="10" paddingRight="10" paddingBottom="10" paddingLeft="10">
<mx:Box width="100%" height="33"
backgroundColor="#B8AF9C" cornerRadius="15" paddingBottom="5" paddingLeft="10" paddingRight="5" paddingTop="5">
<mx:Button label="Fetch RSS" click="RssService.send();RssLoader.height=30"/>
</mx:Box>
<mx:Box id="RssLoader"
width="100%" height="0"
backgroundColor="#B8AF9C" paddingTop="6" paddingRight="10" paddingBottom="5" paddingLeft="10">
<mx:ProgressBar id="rssProgress"
indeterminate="true"
barColor="#B8AF9C"
width="100%"
labelPlacement="center"
label="loading feed"/>
</mx:Box>
<mx:TileList id="FeedDisplay"
width="100%" height="100%"
maxColumns="1"
rowHeight="120" columnWidth="810"
itemRenderer="ItemRenderer"
dataProvider="{rssFeedData}"/>
</mx:VBox>

</mx:TabNavigator>
</mx:Application>


Here is the ItemRenderer file :
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:DateFormatter id="dateFormatter" formatString="D-MMM-YY"/>

<mx:Text id="Title"
htmlText="{data.title}"
x="5" y="0"
fontSize="11" selectable="false"
width="780"
textAlign="left" fontWeight="bold"/>

<mx:Text id="PublishDate"
text="{dateFormatter.format(data.date)}"
x="5" y="{Title.height+3}"
fontSize="9" selectable="false"
width="200"
textAlign="left"
fontWeight="bold"/>

<mx:Text id="Author"
text="{data.creator}"
x="68" y="{Title.height+3}"
fontSize="9" selectable="false"
width="200"
textAlign="left" fontWeight="bold"/>

<mx:LinkButton id="ReadArticle"
label="> read article"
x="700" y="{Title.height-3}"
fontSize="10"
rollOverColor="#B8AF9C"
selectionColor="#595341"
textRollOverColor="#FFFFFF"
textSelectedColor="#FFFFFF"/>

<mx:Text id="Description"
htmlText="{data.description}"
x="5" y="{Title.height+20}"
fontSize="10" selectable="false"
width="780"
textAlign="left"/>

<mx:HRule x="0" y="115" width="100%"/>
</mx:Canvas>

I have this error message :
TypeError: Error #1010: A term is undefined and has no properties.

the error is located in this function :
[Bindable] private var rssFeedData:ArrayCollection;
private function rssHandler(event:ResultEvent):void
{
rssFeedData = event.result.RDF.item;
}

Why would a term being undefined for some RSS data and not for other ?:confused:
Does any of you have an idea to handle it ?

thank you

dr_zeus
09-10-2007, 06:10 PM
There are several versions of RSS out there. If you want a more general solution, I recommend using the open source AS3 Syndication Library (http://code.google.com/p/as3syndicationlib/).

1somniac
09-10-2007, 11:17 PM
I also tried this library, I tried an example of the use of the library given here :
http://orangeflash.eu/?p=18

But there is still the same problem.


In any RSS example I tried, i'm facing the same bug : the RSS can't be read.

Here is another Flash RSS reader link :http://thewarp.org/flex/blogreader.html


If I put any other RSS link than the given one, it result in an error.

It's maybe bug from my computer?

dr_zeus
09-11-2007, 06:00 PM
Do the sites from which you're trying to load RSS have crossdomain.xml?

1somniac
09-11-2007, 11:50 PM
I have just take some documentation on crossdomain.xml, and i have just read that it need a server-side proxy method in order to run the file.

The trouble is that i am developping with Adobe Air, which mean that I can't use a server side langage for uploading file.


Any help ??


thank you

dr_zeus
09-12-2007, 06:01 PM
If you're using AIR, then you don't need to worry about crossdomain.xml. That only applies to browser-based applications.

1somniac
09-12-2007, 10:07 PM
thank you for your answer!

But I would like to make my RSS reader work. What could I do ?