Gossamer Forum
Quote Reply
Parsing XML News Feeds
Has anyone figured out how to parse xml news feeds into Links???
Trying to do:
http://www.washingtonpost.com/wp-srv/world/rssheadlines.xml

</not a clue>
Quote Reply
Re: [Dinky] Parsing XML News Feeds In reply to
Not sure how helpful this will be, but I normally use XML::Simple.

Something like;

Code:
use XML::Simple;

my $page = get("http://www.washingtonpost.com/wp-srv/world/rssheadlines.xml ");

my $xml = XMLin($page);

if (ref $xml->{chanel}->{item} eq "ARRAY") {
for (my $i = 0; $i <= 25; $i++) {
print "Title: " . $xml->{chanel}->{item}[$i] . "\n<br/>";
}
} else {
print "Title: " . $xml->{chanel}->{item} . "\n<br/>";
}

This is totally untested.. but *should* work :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!