Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,
I'm trying to parse an rss feed using LWP:Simple. I've done quite a bit of parsing but I'm stumped on this one new feed. Usually to grab the title I use the following:

$story_headline = $xml->{entry}->[0]->{title}->[0];
But on this particular feed, the title looks like this:
<entry> ... <title type='text'>My Title</title> ... </entry>

The extra "type='text'" is throwing things off. How do I modify my line of code above so that it grabs the data between the title tags?

Thank you!

Replies are listed 'Best First'.
Re: LWP parsing - small question about tags
by ikegami (Patriarch) on Jun 18, 2009 at 19:02 UTC

    I think you mean XML::Simple.

    Use ForceContent => 1 and the following will work whether title has attributes or not:

    $xml->{entry}[0]->{title}[0]->{content};