Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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 = ' +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)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2016-10-23 18:35 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (301 votes). Check out past polls.