Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: TokeParser and newlines

by suaveant (Parson)
on Aug 02, 2012 at 00:27 UTC ( #984923=note: print w/ replies, xml ) Need Help??


in reply to TokeParser and newlines

Well, this isn't exactly right but it'll move you along, don't have time to continue. Probably finding a more comprehensive parser as previously suggested would help

#!/usr/bin/perl -w use strict; use LWP::Simple; use HTML::TokeParser; my $url = 'http://www.georgiastatesports.com/SportSelect.dbml?DB_OEM_I +D=12700&SPID=5671&SPSID=53628'; my $raw = get($url); my $stream = HTML::TokeParser->new(\$raw) or die "$url $!"; while(my $token = $stream->get_token() ) { my $ttype = shift @{ $token }; if ($ttype eq "S") { my($tag, $attr, $attrseq, $rawtxt) = @{ $token }; next until ($tag eq "table"); my $class = $attr->{'class'}; if ($class eq "ScheduleTable") { while($stream->get_tag('tr')) {# my $sched = $stream->get_trimmed_text('/tr'); print "$sched\n"; } } # class eq "ScheduleTable" } # $ttype eq "S" } # while

                - Ant
                - Some of my best work - (1 2 3)


Comment on Re: TokeParser and newlines
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984923]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (12)
As of 2014-09-22 07:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (182 votes), past polls