View Full Version : Cross-browser xml reading.

11-01-2010, 06:09 PM
Hello, I've googled the hell out of this and searched these forums, but can't find a tutorial in laymens terms for me to understand, also, they are all nearly completely different.

I want to be able to get the xml from here: http://feeds.bbci.co.uk/news/world/rss.xml

I have been using Flash (AS2) for the past 4 years and have a high intermediate knowledge of it, I know how to read XML in flash, but I want to learn how to do it with Javascript and HTML5 as I do think this is the way forward - not looking for a debate about this btw :P

Can anyone provide a simple tutorial on how to do this?

thanks! :)

p.s I have a simple knowledge of JS such as simple if statements, other simple statements and changing CSS properties.

11-07-2010, 05:41 AM
First things first, if you are good at AS then you already should be good at javascript because both AS & js are dialects of ECMAScript.

So assuming your knowledge of AS, the question is how do you read XML with AS? You use an XML parser (built in flash).

Similarly you need an XML parser for javascript. There are several js frameworks that do that, you can pack and choose the one you are most confy with.

Just listing the broad steps below:

1. Your HTML document is ready (in other word your DOM tree is complete)
2. Once ready you use ajax to request the XML document (your chosen framework should let you do that)
3. once the ajax call returns the XML you pass it on to your framework's parser and the parser should give you an object.
4. Use this object to populate your html

The frameworks you could look at are jquery, YUI, mootools, etc.