Parsing RSS 2.0 Feeds in ActionScript 3
One of the ActionScript libraries that I use most is the as3syndicationlib. This is an opensource library originally developed by Christian Cantrell, and open sourced by Adobe. The library provides code for parsing RSS 1.0, RSS 2.0 and ATOM data feeds. It also provides a generic interface for parsing feeds when you do not know the format of the feeds.
Below is a simple example of how to use the library to parse an RSS 2.0 feed. The example is written in Flex 3 and ActionScript 3, although I have separated the code to make it easy to also use it within Flash CS3.
In order to compile and run the code below, you need to download the SWC (or source code) for the as3syndicationlib and corelib libraries (as3syndicationlib requires corelib to compile).
RSSExample.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script source="RSSExampleClass.as" />
<mx:TextArea left="20" top="10" bottom="40" right="10" id="outputField"/>
<mx:Button label="Load RSS" right="10" bottom="10" click="onLoadPress()"/>
</mx:Application>
RSSExampleClass.as
import com.adobe.utils.XMLUtil;
import com.adobe.xml.syndication.rss.Item20;
import com.adobe.xml.syndication.rss.RSS20;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
private var loader:URLLoader;
//url of rss 2.0 feed
private static const RSS_URL:String = "http://feeds.feedburner.com/MikeChambers/";
//called when user presses the button to load feed
private function onLoadPress():void
{
loader = new URLLoader();
//request pointing to feed
var request:URLRequest = new URLRequest(RSS_URL);
request.method = URLRequestMethod.GET;
//listen for when the data loads
loader.addEventListener(Event.COMPLETE, onDataLoad);
//listen for error events
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
//load the feed data
loader.load(request);
}
//called once the data has loaded from the feed
private function onDataLoad(e:Event):void
{
//get the raw string data from the feed
var rawRSS:String = URLLoader(e.target).data;
//parse it as RSS
parseRSS(rawRSS);
}
//parses RSS 2.0 feed and prints out the feed titles into
//the text area
private function parseRSS(data:String):void
{
//XMLSyndicationLibrary does not validate that the data contains valid
//XML, so you need to validate that the data is valid XML.
//We use the XMLUtil.isValidXML API from the corelib library.
if(!XMLUtil.isValidXML(data))
{
writeOutput("Feed does not contain valid XML.");
return;
}
//create RSS20 instance
var rss:RSS20 = new RSS20();
//parse the raw rss data
rss.parse(data);
//get all of the items within the feed
var items:Array = rss.items;
//loop through each item in the feed
for each(var item:Item20 in items)
{
//print out the title of each item
writeOutput(item.title);
}
}
private function writeOutput(data:String):void
{
outputField.text += data + "\n";
}
private function onIOError(e:IOErrorEvent):void
{
writeOutput("IOError : " + e.text);
}
private function onSecurityError(e:SecurityErrorEvent):void
{
writeOutput("SecurityError : " + e.text);
}
The code for parsing RSS 1.0 and ATOM feeds is pretty much the same as the example above, except instead of using the RSS20 class, you will use the RSS10 or Atom10 classes.
Note, that full API documents for the library are included in the library download.
What do you do if you don’t know the feed type before you parse it? Well, that is where the library really shines, as it provides a FeedFactory class which can automatically detect and parse any supported feed types. I will try and post an example of using the FeedFactory soon.
You can download the as3syndicationlib library from here.
How does this work with the security sandboxing? I presume FeedBurner allows anyone to download their feeds?
Mark Ingram
22 Jan 08 at 1:48 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Works the same as loading any other remote data. All crossdomain and security restrictions apply.
mike chambers
mesh@adobe.com
mikechambers
22 Jan 08 at 1:54 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
You may like the AMFPHP + MagpieRSS way I use to parses out RSS.
There are a few key reasons why I like to use a remote method for getting something as simple as an RSS feed.
1): No restrictions. No need to worry about crossdomain.xml. That has to be the one thing the stops people from using RSS in flash. There is A lot of RSS feeds out there “Like Netflix” that don’t provide a crossdomain.xml file requiring you to use some form of proxie to get around it. This can also be worked around by using Yahoo’s pipes as a kinda proxie for getting around crossdomain problems
2): Scalability. If you know much about php for this example you could use Magpie’s Integrated Object Caching or leverage the power of php to make use of something more then just a RSS feed only.
3): Usability. This is very simple to impalement, though you may need some prior knowledge of php and flash remoting. Once installed you can make a remote call from flash and pass it the url and get an array back ready to use any way you want.
I made a mini tutorial at http://gfxcomplex.com/blog/amfphp/overcome-flash-and-rss-crossdomain-problems-with-amfphp-and-magpie/
Josh Chernoff
22 Jan 08 at 4:37 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Very usefull example thanks for posting, nice and short
julien
24 Jan 08 at 3:55 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
[...] Chambers shows how to use the as3syndicationlib actionscript library to parse RSS 2.0 Feeds in ActionScript 3. Tags: Actionscript, Atom, Mike Chambers, [...]
Parsing RSS/ATOM in ActionScript 3 | David Bisset: Web Designer, Coder, Wordpress Guru
24 Jan 08 at 8:03 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Great library. A couple things to note:
Despite it being called as3syndicationlib and not mentioning flex, it actually has references to a few flex classes and won’t work in an actionscript only project unless you modify the classes and replace these references.
Its missing a few popular modules namely the Yahoo Media module that most media syndication feeds use.
I wish the framework was a bit simpler or dynamic in incorporating additional modules as right now its a fairly intricate process.
Adobe has released a sample Flex 3 app called Media Widget and the company that developed it, Teknision, used this library for its feed parsing. They’ve modified it adding the Yahoo Media module among other improvements and this updated source is available in Media Wiget source code. The “official” project code hasn’t been updated in over a year and doesn’t reflect these changes.
Overall a class not to live without for any syndication parsing project :)
Mark
24 Jan 08 at 8:57 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
>Great library. A couple things to note:
Well, it is an open source community project, so if anyone would like to add that, or other functionality, just let me know.
mike chambers
mesh@adobe.com
mikechambers
24 Jan 08 at 9:57 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I wouldn’t mind adding some of the things I noted when I find the time but the main thing I wanted to mention in that blob of text is that an updated version of the library is accessible in the Media Widget sample code with flex 3 that has more media feed parsing functionality and namespaces built in, until the library itself is updated–might save someone some time.
Mark
24 Jan 08 at 12:22 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
More on Parsing Feeds with Flex/AS3
Several days ago I posted a couple lines of code that came in quite handy while parsing an Atom feed. Mike Chambers has put together a more in depth post on parsing Atom/RSS feeds using the as3syndica…
T3B
26 Jan 08 at 5:42 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Cant the data be requested using JS nad passed on to the swf for parsing to overcome the crossdomain.xml restrictions?
PL/SQL
26 Jan 08 at 7:23 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Nice example. How do you take care of media-rss etc? I have to hack as3syndicationlib and add those media-rss capabilities.
It would be great to see an example that shows extending as3syndicationlib for various extentions (creativeCommons, a9, media-rss etc).
Thanks
-abdul
Abdul Qabiz
27 Jan 08 at 8:52 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
[...] Parsing RSS Feed January 27, 2008 — drawk Mike Chambers has a great post on parsing RSS in AS3 with as3syndicationlib. I had some info on this but this feed is very simple and just posting the [...]
AS3 Parsing RSS Feed « [ draw.logic ]
27 Jan 08 at 7:41 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
>Cant the data be requested using JS nad passed on to the swf for parsing to overcome the crossdomain.xml restrictions?
Yes, although JS crossdomain restrictions are much stricter than Flash’s (Flash has a permission based way around them via crossdomain.xml).
mike chambers
mesh@adobe.com
mikechambers
28 Jan 08 at 10:07 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
>How do you take care of media-rss etc? I have to hack as3syndicationlib and add those media-rss capabilities.
Ill try and see if I can get Christian to respond, but you can grab individual raw items from the feed in order to extend the parser.
mike chambers
mesh@adobe.com
mikechambers
28 Jan 08 at 10:09 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hello,
I’m trying to get your example to work with Flash CS3 but I ran into a problem.
ReferenceError: Error #1065: Variable mx.utils::StringUtil is not defined.
at com.adobe.xml.syndication::ParsingTools$/nullCheck()
at com.adobe.xml.syndication.rss::RSS20/get items()
at main/parseRSS()
at main/onDataLoad()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
In ParsingTools.as I found:
import mx.utils.StringUtil;
This class [mx.utils.StringUtil] seems to be part of the Flex library and not in Flash CS3, any suggestions on how I can get this to work?
Dave
30 Jan 08 at 6:42 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Make sure to link in the corelib library:
http://code.google.com/p/as3corelib/
mike chambers
mesh@adobe.com
mikechambers
30 Jan 08 at 9:00 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I am importing the as3corelib package and can reference them. From what I can tell all the packages in as3corelib are packaged as com.adobe.[name].[name] But in ParsingTools.as it imports mx.utils.StringUtil – different package name. To test I wasn’t doing anything too crazy I created a new flash file and tried this.
———————
import mx.utils.StringUtil;
var s:String =”adfadfaf”;
trace(StringUtil.trim(s).length == 0)
———————
the result was this:::
ReferenceError: Error #1065: Variable mx.utils::StringUtil is not defined.
at testUtil_fla::MainTimeline/frame1()
———————
Are you able to get it to work using Flash CS3?
Dave
30 Jan 08 at 12:17 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
>mx.utils.StringUtil
Ahh, actually, that is the Flex String utils. I just checked the code, and if you change the import from:
mx.utils.StringUtil
to
com.adobe.utils.StringUtil
It should work (the second is the StringUtil in corelib).
I try and update the library with this fix soon.
mike chambers
mesh@adobe.com
mikechambers
30 Jan 08 at 12:32 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
That did the trick.
Thanks!
Dave
30 Jan 08 at 12:38 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hello,
Could you provide a sample of how to retrieve “media” from an RSS20Item. I’ve been trying but the media property always returns null. Other properties such as link or id do return values.
Thanks
Dave
31 Jan 08 at 3:40 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hello, i ran into an issue with the DateBase class and Flash CS3. I think it’s the mx.formatters.DateBase classe from Flex i think.
It’s not available in the as3corelib but it is accessed threw syndication lib. Is there a workaround similar to the StringUtil class?
DateBase class is used by the DateUtil class from the as3corelib (com.adobe.util – package).
thanks, hannes
Hannes Moser
5 Feb 08 at 4:14 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Same issue as Hannes.
DateUtil.as imports mx.formatters.DateBase which doesn’t appear to be a class of either the syndication or corelib packages.
Steve Nelson
6 Feb 08 at 2:35 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Steve
I made this little class that I put in ‘com.adobe.utils’, which contains JUST ENOUGH to get the syndication API going. You can get the source here:
http://www.newcommerce.ca/as3/DateBase.as
Simply change the instances of:
import mx.utils.DateBase;
by:
import com.adobe.utils.DateBase;
BTW: Somebody might want to doublecheck this, as I’m not 100% sure it’s correct.
:)
Martin Legris
8 Feb 08 at 11:59 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Thank you Martin!
Mike: Once I made that substitution and tried again to compile, the mx.utils.StringUtil class was requested, but when I changed that to com.adobe.utils.StringUtil it finally compiled and worked. I really appreciate your help Martin, and Mike I really appreciate this information.
Steve
Steve Nelson
9 Feb 08 at 2:19 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Mike,
Thanks for the great tutorial. Your code made it easy to get a jump start on working with the library. This post inspired me to build a simple app that uses a Yahoo Pipes RSS feed (combining snap previews with digg stories). I ended up using a php caching script to get around crossdomain issues.
Here is the demo w/source:
http://infinitearray.com/blog/2008/02/yahoo-pipes-flex.html
Ryan Robinson
10 Feb 08 at 6:00 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I’ve extended the as3syndicationlib so that you can use it with Media RSS. There are about ten new classes that represent all the media rss elements. All Media RSS tags must be within the “media:content” tag, groups and more than one element of the same tag are not supported at the moment.
You can download the very first version in the comments of this post:
http://www.video-flash.de/index.php/as3syndicationlib-rss-und-atom-feeds-mit-actionscript-3-parsen/#comments
Flo
20 Feb 08 at 2:46 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I’m getting errors when importing the SWC (I have Corelib SWC imported already). I narrowed down the bug to be in the RSS20.
If I just create a RSS20 object I get two errors:
Unable to resolve resource bundle “formatters” for locale “en_US”.
Unable to resolve resource bundle “SharedResources” for locale “en_US”.
Danny
22 Feb 08 at 7:27 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
sorry, i can’t find your email, so i’m posting it here.
i think you’ve been plagiarized…
http://www.elokcomputer.web.id/2008/02/09/parsing-rss-20-feeds-in-actionscript-3/
Ted
9 Mar 08 at 6:52 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hi,
Just wanted to remind you about this:
http://www.mikechambers.com/blog/2008/01/22/parsing-rss-20-feeds-in-actionscript-3/#comment-10994
I had the same issue.
Thanks
Adam Bowman
16 Mar 08 at 8:06 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Awesome! I’m using this with Yahoo Pipes (to combat cross-domain issues) to build a feed reader. It works a darn treat! Cheers Mike!
Ed
18 Mar 08 at 10:42 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
@Ed – I’m trying to use Pipes in the very same way but still receiving crossdomain security errors (SecurityError: #2048).
Would you mind explaining how you are able to use Pipes to bypass Flash’s built-in crossdomain enforcement?
Thanks.
- Chris
Chris
25 Mar 08 at 12:30 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Chris, the way I did it was to set up a simple pipe to parse a feed of the user’s choosing, using the Pipes url input and fetch modules. I then set up Flash to parse the resulting Pipes feed address (using the as3syndicationlib) along with the request url of the feed address. Oh, and you have to use the yahooapis.com domain for your request URL as that’s where the vital crossdomain.xml policy file lives on Yahoo’s servers. So your request URL should look something like this (replace the capital letters and hyphens accordingly):
http://pipes.yahooapis.com/pipes/pipe.run?_id=PIPE-ID&_render=rss&NAME-OF-URL-INPUT-MODULE=http://URL-OF-FEED
Hope that helps!
Ed.
Ed
26 Mar 08 at 11:16 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Ed,
Great – thanks! That is a vital piece of information that I didn’t find on Yahoo! Pipes. I need to look better next time.
I need to look at the API and see if it’s possible to add feeds to a pipe progmatticaly as that would be sweet.
Thanks.
Chris
31 Mar 08 at 12:29 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Ed,
Pardon me but do you know if it possible to bypass the need for a pipe – or – to simply isolate a single RSS feed URL and access it directly through yahooapis.com/pipes?
I see what might be a snippet of that in your “&NAME-OF-URL-INPUT-MODULE”.
Basically, I have a list of feeds stored in our Oracle database that the user is able to customize. When selecting one of those feeds, I’m currently use DBMS_XMLQuery to extract the values using HTTPURITYPE.getXML(). The problem with this approach is that my XML output doesn’t come back with an header, therefore Adobe Flex is kinda like “Huh?” when it sees the output.
Since I can’t find an approach to inserting an feed directly into a Pipe (thinking about it, that would be pretty hard to do since the user has to connect feeds to outputs, etc.); I was thinking that might be able to access an RSS url through Yahoo Pipes without the need for having that feed inside of an already created pipe.
Does that make sense? Look forward to seeing your response.
Thanks.
Chris
31 Mar 08 at 1:03 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hello everyone.
Trying to parse the following feeds, I get an “Unable to determine feed type”!
http://www.heise.de/security/news/news.rdf
http://www.heise.de/newsticker/heise.rdf
Why? I think this is normal rss 1.0…
Thanks for any suggestions!
Greetings,
Tim.
Tim
21 Apr 08 at 2:02 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
How can this library be compiled/ build???
Is there a way doing it using Flex 2.0 on WinXP?
Greetings and thanks,
Tim.
Tim
21 Apr 08 at 7:04 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I would want to use this in Flash CS3 (no Flex). Any chance someone could give me (and others) some points as to how to do that? I’ve tried and not getting anywhere…
Magnus
7 May 08 at 9:16 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
[...] suposed to be informative and quick. In regards to use the FlashDevelop IDE and it is based off of Mike Chambers [...]
i-create | therefore-i am » Blog Archive » FlashDevelop Quick Start
18 May 08 at 10:27 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
This solution pared with Yahoo! Pipes worked like a charm. Good stuff, good stuff.
John
27 May 08 at 2:42 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hi, I used the library in my application to read RSS feeds but for some reason it only works in IE and not Firefox??? When the Firefox browser begins to load the RSS, it will display “Transferring data from …” or “Reading RSS …” but it just stays like that forever. Nothing actually happens. Please help if you can. Thanks in advance.
Sam
28 May 08 at 10:01 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
*** For those wanting to use this stuff in Flash CS3… ***
I too came up against the problem of certain classes failing to import in Flash (the mx ones)… but with some good old fashioned digging, I found that the old “mx.formatters.DateBase” class was really close to a class included by Adobe in their “Programming Actionscript 3″ examples… I added a couple of static arrays for month and day names and it started to work. In addition, there were just some problems with things like “StringUtils” being moved into different packages with the porting to AS3, so I updated the “import” directives to take care of that.
The bottom line is “IT ALL WORKS” – based on Mike’s code above, I have uploaded a ZIP of the above work, (including the corelib classes) at http://www.g-raff.com/downloads/syndicationExample.zip – maybe someone can assist me in letting me know the correct protocol for adding this new ported “DateBase” class to the corelib?
Anyway – this example is specifically for users of Flash – a syndication example that just does exactly what Mike is doing above, but including the FLA and a little SyndicationExample.as file that I just wrote – its basically a template method so you can take it from there. In addition, my file takes the URL of the feed as a single argument, so you are not restricted to one feed… you’ll see when you open the files.
Thanks for the starting point, Mike.
Steve jones
Steve Jones
31 May 08 at 1:26 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hi Mike!
Thanks for the examples and classes. I just submitted a patch to the library for GeoRSS support. It’d be great to see it integrated, as I’m going to be recommending people use this framework in the Flasj Maps API for parsing GeoRSS feeds.
- pamela
Pamela Fox
4 Jun 08 at 1:53 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
In this tutorial by Lee Brimelow, he showcases how to parse XML with the kuler namespace. http://www.gotoandlearn.com/player.php?id=65
I am just wondering if it POSSIBLE to parse mediaRSS without the use of all these libraries, just using the techniques shown by Lee Brimelow?
Marcus
23 Jun 08 at 12:46 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
[...] Parsing RSS 2.0 Feeds in ActionScript 3 [...]
Tutorials | Creating RSS readers with Flash and Flex « Flash Enabled Blog
10 Jul 08 at 2:59 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
[...] Parsing RSS 2.0 Feeds in ActionScript 3 ???????http://blog.minidx.com/2008/07/21/1112.html [...]
ActionScript 3???as3syndicationlib?corelib?????RSS 2.0??? - ??Flex??
20 Jul 08 at 9:34 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
To Martin Legris and all those using his DateBase.as.
Thought might be good to let everybody know its missing August in both months array.
Thanks for all the good works
jp
jpye
18 Aug 08 at 2:52 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
[...] Steve Jones ran across the same errors earlier, fixed them, and shared his solution on Mike’s [...]
Google Groups to Google App Engine: you seem a little shifty to me! at Aral Balkan
20 Aug 08 at 8:31 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hi Mike,
Thanks a lot for this sample :)
It’s just working so nicely! I think I’ll add rss everywhere in my projects now :p
SeeYa!
Jean-Christophe TURIN
27 Aug 08 at 2:47 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Ed or who may be able to help,
Where and how do you place the policy XML file required by flash in yahoo pipes?
I need thie to point at my domain (of course).
Many thanks in advance!
Elliot
Elliot R
1 Sep 08 at 2:44 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Ok I found all the obvious information to answer my “late night” question above.
I am still having issues with the correct URL on pipes to load my RSS feed from as3.
@Ed,
Is it possible for you to provide examples of your pipes setup and how you implemented it in as3, please.
Cheers
Elliot
Elliot R
1 Sep 08 at 5:36 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I have solved all my issues and have a live FLash version to show.
http://www.iinet.net.au/~elliotrock/
It is order on the rss categories, which I had to use a Rename Module on pipes to place back into the Output from pipes.
For those who need to know the policy file lives here:
“http://pipes.yahooapis.com/crossdomain.xml”
And you need to direct your feed to pipes.yahooapis.com to be on the same domain as the cross-domain-policy
Elliot R
8 Sep 08 at 7:00 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Glorious. Flash CS3 rather than Flex needed a couple of extra imports but no bother, thanks for posting this came in very handy :)
Rob McCardle
17 Sep 08 at 1:25 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Error: Unable to parse the string [October 8, 2008 18:31] into a date. The internal error was: TypeError: Error #1010: A term is undefined and has no properties.
at com.adobe.utils::DateUtil$/parseRFC822()
any ideas?
mike
9 Oct 08 at 12:37 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
[...] is an 3rd party class that Adobe hosts called as3syndicationlib. Mike Chambers blog shows how to use this class. I had already done my own hack to the xml data before I stumble apon [...]
Elliot Rock » Blog Archive » Loading RSS Feed Content
17 Oct 08 at 7:13 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
If people want to see my result of converting WordPress to a AS3 flash blog check:
http://www.elliotrock.com
I am super keen to spend time to document how I ended up doing it and providing classes and method for a bit more blog-like functionality. I will get on to it soon.
Elliot Rock
6 Nov 08 at 10:41 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
First off, a warning: I’m new to much of this.
I cannot, for the life of me, figure out how to use this in flash cs4. I added the swc to the components folder and then generally cut and pasted the whole package all over the cs4 directory.
clearly I’m missing something
any help would be very appreciated.
peter
12 Nov 08 at 11:49 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I built a fully functional RSS feeder in AS3, and then when it got uploaded to my server, the RSS wouldn’t be read in anymore.
It appeared to be an obvious failure of crossdomain.xml, but making the file and saving it in my root directory did nothing.
What can I do to get this guy working?
kristian
3 Dec 08 at 7:57 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hmm. i did the adjustments as noted for the Flash version.. so no more class errors, but i cant parse any feeds.. i always get that the feed isn’t valid when it tries to use isValidXML.. and if i comment out that portion i get..
TypeError: Error #1085: The element type “meta” must be terminated by the matching end-tag “”.
at com.adobe.xml.syndication::NewsParser/parse()
ive tried a few different feeds, and no luck.
Ben Faubion
7 Dec 08 at 1:19 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
works fine in CS3!… even with just the URLLoader in CS4, im getting that error above.. must be a CS4 issue, or my computer’s issue, its not even related to this class…
Ben Faubion
7 Dec 08 at 1:40 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
The category fix from 12-NOV doesn’t seem to be included in the .85 zip downloadable via the Google Code page. Has anyone gotten RSS 2.0 categories working? Did you have to recompile the SWC file(s) to incorporate the fix? Would you mind posting a code sample of how to parse the category tags?
Also, does this library support Media RSS now? If so, does anyone have a code sample they can post?
Thanks!
harmst
17 Dec 08 at 1:35 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
[...] I start to take a look around in the web and I find an Adobe library, made by Mike Chambers, that allow you to parse all kinds of feeds: RSS 1.0, 2.0 and ATOM. When I tried to use it on my [...]
Parsing RSS 1.0, 2.0 and Atom feeds with Actionscript 3 and Flash CS4 « flash platform! {desktop, mobile, touch screen…}
7 Feb 09 at 3:13 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
How do i access non standard properties? Say my RSS has a 47.34
item20rss['gsx:latitude'] ??
PS: I am new to Flex/AS3/Adobe platform
Anirudh
7 Feb 09 at 6:46 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
[...] I could trace the received XML just fine, but accessing ANY node in it was impossible. Then I found this on mesh’s blog: a great tutorial on using the following two libraries for unknown XML formats in RSS/Atom feeds: – [...]
Solution #2: parsing RSS/Atom feeds w/ unknown XML format « rabbitpot
15 Mar 09 at 3:25 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
If anyone is interesting in the same Library for Flash, I modify some packages and published on my blog at this address http://lucamezzalira.com/2009/02/07/parsing-rss-10-20-and-atom-feeds-with-actionscript-3-and-flash-cs4/
Bye
luca mezzalira
21 Mar 09 at 1:46 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
both latest lib files from googlecode are based on flex,and take a look:
1),Channel20.as and ParsingTools.as:
// flex class, there’s a StringUtil.as in one zip
import mx.utils.StringUtil;
2),DateUtil.as
// DateBase.as is a flex class
// it’s not in flash cs4, neither in the zips
import mx.formatters.DateBase
Lance
16 Apr 09 at 12:42 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I tried to use the code on my flash AS3 but it has many errors, the first one (ActionScript Error #1013: The private attribute may be used only on class …) on the line : private var loader:URLLoader;
can you help me?
thanks!
john
5 May 09 at 11:11 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
[...] Here’s an interesting article on how to use the as3syndication library in order to use those Atom feeds. [...]
XML != Atom? « Joris’s Blog
16 May 09 at 2:59 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I just finished putting this thing together for AS3. I had to change all the references from mx.utils.StringUtil to com.adobe.utils.StringUtil, and I had to use the custom DateBase class provided by Mr. Martin Legris above (Many Thanks!) and everything compiles fine. Now I just need to get this thing running with my new yahoo pipe!
Great post!
Ian
29 May 09 at 12:23 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
TypeError: Error #1034: Type Coercion failed: cannot convert com.adobe.xml.syndication.atom::Entry@1c4d1b51 to com.adobe.xml.syndication.generic.Atom10Item.
What have I done wrong here?
Jason
10 Aug 09 at 10:08 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hi,
first, that plugin is pretty cool.
The only thing I wish I could understand is
the pubDate Item…
Getting a Rss2 from a wordpress generator, the pubDate
is all messed up when I access it in anyway using item.pubDate. i.e. -> instead of having “Mon, 03 Aug 2009 19:18:38 +0000″(from the traced XML), I get “Wed Dec 3 14:18:38 GMT-0500 2008″(from traced item.pubDate) … ! Anyone has an idea? I can’t believe I’m the only one…. Thanks!
c-a
12 Aug 09 at 9:44 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
This may be a stupid Q, but I am wondering if it is possible to send an XMLList to be parsed and apply CSS to instead of pulling out individual items and iterating through them as you have shown in your example. I am trying to do this on my own and finding it more difficult then imagined.
thanks for any direction anyone can point me in!
erik
20 Oct 09 at 5:25 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Ahh.. Nice post. RSS feed is very nice. Take a look at a version I made. http://theactionscripter.com/2009/11/03/reading-a-rsstwitter-feed-with-actionscript-3.aspx It also does Twitter feeds.
Mike
3 Nov 09 at 12:25 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
OK, really hoping someone can help here. I can’t make something happen:
I need to read elements in an RSS 2.0 feed that fall outside the standard RSS 2.0 types and are specified in other namespaces:
For instance, I want to be able to access in this way
myRSS20.items.item.point
an element that in the feed is string
Of course the compiler throws an error saying that point is not a property of Item20.
Must I extend Item20 to a class that contains my necessary properties and then extend RSS20 to write ExtItem20 objects into the items array instead of Item20 objects?
I’m a bit confused. Seems like RSS20Feed and the generic package is the answer, but I don’t understand how right now. Any help is greatly appreciated…
Scott
11 Nov 09 at 10:09 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
uggh. just realized in my post above the brackets caused the xml to be cut out of my post. corrected is here:
OK, really hoping someone can help here. I can’t make something happen:
I need to read elements in an RSS 2.0 feed that fall outside the standard RSS 2.0 types and are specified in other namespaces:
For instance, I want to be able to access in this way
myRSS20.items.item.point
an element that in the feed is namespace:point, which is a child of every item element
Of course the compiler throws an error saying that point is not a property of Item20.
Must I extend Item20 to a class that contains my necessary properties and then extend RSS20 to write ExtItem20 objects into the items array instead of Item20 objects?
I’m a bit confused. Seems like RSS20Feed and the generic package is the answer, but I don’t understand how right now. Any help is greatly appreciated…
Scott
12 Nov 09 at 9:44 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
OK, maybe I should have tried this before I posted, but I didn’t think I knew what I was doing. But I tried and succeeded in extending the RSS20 class and Item20 class to allow my namespaces and xml elements in addition to the standard RSS 2.0 spec. I am now able to access any type of element within the RSS XML by including its namespace as another namespace in the extended Item20, and I just wrote getters for these new elements. Then I just extended RSS20 to add instances of my ExtendedItem20 class into the ‘items’ array instead of Item20 instances…
Scott
12 Nov 09 at 2:03 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I access it in anyway using item.pubDate. i.e. -> instead of having “Mon, 03 Aug 2009 19:18:38 +0000?(from the traced XML), I get “Wed Dec 3 14:18:38 GMT-0500 2008?(from traced item.pubDate) … !
gucci
14 Dec 09 at 7:04 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Is there any way to use this API to POST Atom data to a server in addition to parsing received Atom data? I need to talk to Google’s Data API and it requires that requests be in Atom format as well. Thanks!
david
30 Dec 09 at 12:37 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Mike,
Am trying to read an Atom feed using CS4 flash and as 3.0, am getting ”
3:coerce com.adobe.xml.syndication.rss::Item20
VerifyError: Error #1014: Class com.adobe.xml.syndication.rss::Item20 could not be found.”
any insight?
thanks
Dan
23 Jan 10 at 9:53 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
[...] here: http://www.adobe.com/ And theres a ton of pointers online for reading RSS in AS3, like this: http://www.mikechambers.com/blog/2008/01/22/parsing-rss-20-feeds-in-actionscript-3/ If you got the skills to pay the bills then git' to it pardners'. A-yeeeeeeeharrrrRRS!! Permalink [...]
Codeo Challenge #4: A-yeeeeeeeharrrrRRS | Cogapp
1 Feb 10 at 8:23 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hello,
I need to develop myyahoo like rss feed reader. which has options to filter reads by
1)number of feeds (i want to display only first n feeds only)
2)image and summary
header and summary only
can someone provide me any example or suggest me how to filter from the feeds
ren
8 Apr 10 at 10:01 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Is this lib going to be updated one day ?
It has lot of issues reported but no one seems to care.
(if only I had enough knowledge with rss feeds to fix it myself…)
Adnan Doric
9 Apr 10 at 4:16 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
I need to read elements in an RSS 2.0 feed that fall outside the standard RSS 2.0 types and are specified in other namespaces:
dropship
16 Apr 10 at 1:36 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Hi guys, I don’t know if anyone has stumbled on this problem before. When you use a try … catch block to check the rss.parse(feeddata), an exception is thrown::Unable to parse the string [FRI, 23 JUL 2010 07:27:00] into a date. The internal error was: TypeError #1009: Cannot access a propertyof a null object reference.
I suspect the date format form the syndication is wrong so I wanted to intercept it to correct he date format which would require some xml manipulation. I’d like to know if there is a better way to deal with this problems. Sincewe do not have control over how the feed is syndicated, it would be good to find a way to make the application handle these exceptions graciously rather than blowing up. The source code for the syndication library is not available or is it? I could look into it if I could find the source code. Anyone with any help?
oluwaseun
27 Jul 10 at 3:01 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Thanks Mike great post,
I’ve created a really simple game using an RSS feed from Twitter wrapped it around FeedBurner(for security domain issues) and made a video about loading RSS into a flash application.
if anyone wants to watch a video on the topic or check out other AS3 videos check out this link or the site in general.
http://everythingfla.com/courses/video/14/119
Ben
27 Aug 10 at 5:17 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
same as Ben faubion isXMLValid throws error, i am in Flash CS5
Ventoline
24 Feb 11 at 9:41 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>