hesco has asked for the wisdom of the Perl Monks concerning the following question:
Based on advise from Michel Rodriguez, author of XML::Twig, I am trying to employ ->findnodes() to parse from an html file a the content of each li tag. This is what I've got so far:
But this keeps throwing an error on the ->parseurl line, reading:sub parse_mm_archive_cycle { my $self = shift; my $base_url = shift; my $cycle = shift; $cycle =~ s/:$//; my $url = "$base_url/$cycle/date.html"; print STDERR $url, "\n"; $self->{'agent'}->get( $url ); my $html = $self->{'agent'}->content(); $self->{'twig'}->parseurl($url,$self->{'agent'}); print STDERR 'Our twig objects is: ' . Dumper($self->{'twig'}); # $self->{'twig'}->parseurl($url); # my $root = $self->{'twig'}->root; for my $story ($self->{'twig'}->findnodes("li")){ print STDERR 'Next story: ' . Dumper($story); } return; # $html; }
Can anyone who has used this before please offer some advise?syntax error at line 1, column 48, byte 48 at /usr/lib/perl5/XML/Parse +r.pm line 187 at lib/CF/mmFeedParser.pm line 113
if( $lal && $lol ) { $life++; }
if( $insurance->rationing() ) { $people->die(); }
if( $insurance->rationing() ) { $people->die(); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: XML::Twig won't parse my url
by ambrus (Abbot) on Jan 06, 2011 at 10:11 UTC | |
Re: XML::Twig won't parse my url (RTFMS)
by tye (Sage) on Jan 06, 2011 at 00:59 UTC | |
Re: XML::Twig won't parse my url
by ikegami (Patriarch) on Jan 06, 2011 at 02:27 UTC |
Back to
Seekers of Perl Wisdom