summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/efa19
1 files changed, 11 insertions, 8 deletions
diff --git a/bin/efa b/bin/efa
index 764cfa4..49b658f 100755
--- a/bin/efa
+++ b/bin/efa
@@ -7,7 +7,7 @@ use warnings;
use 5.010;
use Getopt::Long qw/:config no_ignore_case/;
-use HTML::TreeBuilder::XPath;
+use HTML::TreeBuilder::LibXML;
use WWW::Mechanize;
my $firsturl = 'http://efa.vrr.de/vrr/XSLT_TRIP_REQUEST2?language=de&itdLPxx_transpCompany=vrr';
@@ -37,8 +37,9 @@ sub check_ambiguous {
"Ambiguous input for %s\n",
$select->attr('name'),
);
- foreach my $val ($select->findnodes_as_strings('./option')) {
- say "\t$val";
+ foreach my $val ($select->findnodes('./option')) {
+ print "\t";
+ say $val->as_trimmed_text();
}
}
if ($ambiguous) {
@@ -77,7 +78,7 @@ sub display_connection {
}
printf(
- "%-5s %-2s %-30s %-20s %s\n%-5s %-2s %-30s\n\n",
+ "%-5s %-2s %-30s %-20s %s\n%-5s %-2s %-30s\n\n",
@{$con}[0, 1, 2, 3, 7, 4, 5, 6],
)
}
@@ -209,7 +210,7 @@ sub parse_tree {
}
if ($colspan == 8) {
- if ($td->as_text() =~ / (?<no> \d+ ) \. .+ Fahrt /x) {
+ if ($td->as_trimmed_text() =~ / (?<no> \d+ ) \. .+ Fahrt /x) {
$con_no = $+{'no'} - 1;
$con_part = 0;
next;
@@ -225,8 +226,8 @@ sub parse_tree {
}
}
- if (not $td->exists('./img') and $td->as_text() !~ /^\s*$/) {
- push(@{$cons->[$con_no]->[$con_part]}, $td->as_text());
+ if (not @{$td->findnodes('./img')} and $td->as_text() !~ /^\s*$/) {
+ push(@{$cons->[$con_no]->[$con_part]}, $td->as_trimmed_text());
}
}
return $cons;
@@ -325,7 +326,9 @@ if ($test_dump) {
exit 0
}
-my $tree = HTML::TreeBuilder::XPath->new_from_content($content);
+my $tree = HTML::TreeBuilder::LibXML->new();
+$tree->parse($content);
+$tree->eof();
check_ambiguous($tree);