tags:

views:

300

answers:

3

I'm a complete noob in all of this, but sometime ago I wrote a little script in Perl to parse an RSS feed. It starts like this:

use strict;
use XML::RSS::Parser;
use Data::Dumper;
my $url = "http://www.livenation.co.uk/Venue/159/Southampton-Guildhall-tickets/RSS";
my $parser = XML::RSS::Parser->new();
my $feed = $parser->parse_uri($url);
print Dumper( $feed );
print $parser->errstr();

It used to work (can't remember when I last checked it, but a few weeks ago it seemed to work), but today it no longer does. The RSS feed is alive, and passes through feedvalidator.org. The errstr() returns this:

End tag mismatch (title != description) [Ln: 67, Col: 95]

I'm not really sure how this happened or what this means. The source of the RSS reads:

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"&gt;

I don't know if it was different before. I tried a few other atom feeds and the parser seems to break on all of them. The problem is though, sysadmin is not back until after the deadline, so I have to use what's available.

UPDATE:

interesting. it breaks on both my w7 64 *active perl) and ubuntu (32, 9.10) installs. works fine on my friend's ubuntu though (same, 9.10). i tried reinstalling the modules, but that doesn't seem to change anything.

+1  A: 

Works for me just now. Perhaps the RSS feed had bad corrupt XML in it for a while? The error seems to point to miss-matched tags in the feed at the line indicated.

If it is still happening try using curl (or similar) to display the raw XML and check it for errors.

Gavin Brock
Are we all seeing the same data? For me, line 67 of the feed data is:<title><![CDATA[Tylers Benefit Gig in aid of Cystic Fibrosis - with The Rebs]]></title>Maybe perl/module versions differ - I have: perl -MXML::RSS::Parser -e 'warn "$^V $XML::RSS::Parser::VERSION $XML::Elemental::VERSION $XML::SAX::VERSION"'v5.10.0 4 2.11 0.96 at -e line 1.
Gavin Brock
v5.10.0 4 2.11 0.96 as well here, yet I get an error message. It certainly looks valid.
Anonymous
+1  A: 

I'm getting the same error (same message and line number) with a fresh install of XML::RSS::Parser and the modules it uses (it's just a wrapper for feed structure over XML::Elemental, which uses XML::SAX to parse, etc).

Firefox, however, indicates that the file is valid.

XML::Tiny seems to be able to parse the file, so that may be enough with a little work to transform it.

Anonymous
A: 

You need to look at the actual source to see what's going on. Not just "go to the website in a browser", but look at the actual source the program is seeing. Who knows what happened? Some kind of glitch where only half the document got sent? Different source sent because it's not the same client?

I would do a dump of the XML every time every time the program runs and examine it when there are errors.

AmbroseChapel