I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2006-12-26 14:15:54-08 by davehope
Accessing namespace elements
Hello all, Firstly, my appologies for the poorly worded subject I'm using XML::RSS to parse a Flickr rss photo feed, this kind of works. I can access normal elements (title, url etc..) however elements with a namespace (in this case, media) I'm having problems with. I have the following:
my $rss = XML::RSS->new(); my $data = get( $url ); $rss->parse( $data ); $rss->add_module(prefix=>'media', uri=>'http://search.yahoo.com/mrss/'); my $channel = $rss->{channel}; my $image = $rss->{image}; foreach my $item ( @{ $rss->{items} } ) { print qq|<a href="$$item{link}">$$item{title}</a><br /><br />\n|; my $tempmedia = $$item{content}; print qq|$$tempmedia->{url}\n|; }
So, i'm trying to access the following:
<item> <title>Fireworks 4</title> <link>http://www.flickr.com/photos/davehope/293811368/</link> <media:content url="http://farm1.static.flickr.com/113/293811368_f1e2c2d45a_o.png" type="image/jpe +g" height="678" width="848" /> </item>
Accessing title and link works fine, how do I go about accessing media:content url for example? Thanks guys. Hope you're all having a nice Christmas break, Dave
Direct Responses: 6455 | Write a response