I need to parse an RSS feed (XML version 2.0) and display the parsed details in an HTML page.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Parsing the Feed
With jQuery‘s jFeed
(Don’t really recommend that one, see the other options.)
With jQuery‘s Built-in XML Support
With jQuery and the Google AJAX Feed API
But that means you’re relient on them being online and reachable.
Building Content
Once you’ve successfully extracted the information you need from the feed, you could create
DocumentFragments (withdocument.createDocumentFragment()containing the elements (created withdocument.createElement()) you’ll want to inject to display your data.Injecting the content
Select the container element that you want on the page and append your document fragments to it, and simply use innerHTML to replace its content entirely.
Something like:
or:
Test Data
Using this question’s feed, which as of this writing gives:
Executions
Using jQuery’s Built-in XML Support
Invoking:
Prints out:
Using jQuery and the Google AJAX APIs
Invoking:
Prints out: