From 8eab0da2f889cff51e60ecc5644441ee92c4b012 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 25 Oct 2020 15:59:59 +0100 Subject: Oh HAFAS, you so funny --- lib/DBInfoscreen/Helper/HAFAS.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm index 2e832be..9e507e4 100644 --- a/lib/DBInfoscreen/Helper/HAFAS.pm +++ b/lib/DBInfoscreen/Helper/HAFAS.pm @@ -99,16 +99,22 @@ sub get_xml_p { my $body = decode( 'ISO-8859-15', $tx->res->body ); - # is invalid HTML, but present + # is invalid XML, but present # regardless. As it is the last tag, we just throw it away. $body =~ s{]*/>}{}s; + # is invalid XML. + # Work around it. + $body + =~ s{load_xml( string => $body ) }; if ($@) { $cache->freeze( $url, {} ); + $self->{log}->debug("hafas->get_xml_p($url): Parse Error: $@"); $promise->reject; return; } -- cgit v1.2.3