comparison parsedata.pl @ 165:1d17dbb864ff

Fix parsing of new format of UNTIS html output.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 23 Aug 2015 19:39:42 +0300
parents 2654466d2655
children 8b2107f0d50b
comparison
equal deleted inserted replaced
164:2654466d2655 165:1d17dbb864ff
428 } 428 }
429 429
430 # Filter out some more, for easier tree access during table parsing 430 # Filter out some more, for easier tree access during table parsing
431 $data =~ s/<\/?b>//ig; 431 $data =~ s/<\/?b>//ig;
432 my $tree = parse_html($data); 432 my $tree = parse_html($data);
433 my $node = fnode(fnode($tree, "body"), "table"); 433 my $node = fnodea(fnode($tree, "body"), "table", "border=\"3\" rules=\"all\" cellpadding=\"1\" cellspacing=\"1\"");
434 die("No table element found in document. Perhaps the format has changed? :(\n") unless defined($node); 434 die("No table element found in document. Perhaps the format has changed? :(\n") unless defined($node);
435 435
436 436
437 ### Parse through the HTML document node tree to find the data we need 437 ### Parse through the HTML document node tree to find the data we need
438 438
446 foreach my $n (@{$d}) 446 foreach my $n (@{$d})
447 { 447 {
448 my $l = $$n{"nodes"}[0]{"nodes"}; 448 my $l = $$n{"nodes"}[0]{"nodes"};
449 if (defined($l)) 449 if (defined($l))
450 { 450 {
451 if ($$n{"args"} =~ /colspan=6\s+rowspan=(\d+)/) 451 if ($$n{"args"} =~ /colspan=12\s+rowspan=(\d+)/)
452 { 452 {
453 parse_hour_data($l, $1); 453 parse_hour_data($l, $1);
454 } 454 }
455 elsif ($$n{"args"} =~ /rowspan=2\s+align/) 455 elsif ($$n{"args"} =~ /rowspan=2\s+align/)
456 { 456 {