diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-10-25 15:59:59 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-10-25 15:59:59 +0100 |
commit | 8eab0da2f889cff51e60ecc5644441ee92c4b012 (patch) | |
tree | d8f894c185423e9f8588f1b7fc49e096b29e5e1a | |
parent | 717cc78f5a8c34c687eabed6b9e4babd300620a3 (diff) |
Oh HAFAS, you so funny3.4.5
-rw-r--r-- | lib/DBInfoscreen/Helper/HAFAS.pm | 8 |
1 files changed, 7 insertions, 1 deletions
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 ); - # <SDay text="... > ..."> is invalid HTML, but present + # <SDay text="... > ..."> is invalid XML, but present # regardless. As it is the last tag, we just throw it away. $body =~ s{<SDay [^>]*/>}{}s; + # <Attribute [...] text="[...] "[...]"" prio="800" /> is invalid XML. + # Work around it. + $body + =~ s{<Attribute text="([^"]*)"([^"=]*)""}{<Attribute text="$1*$2*"}s; + my $tree; eval { $tree = XML::LibXML->load_xml( string => $body ) }; if ($@) { $cache->freeze( $url, {} ); + $self->{log}->debug("hafas->get_xml_p($url): Parse Error: $@"); $promise->reject; return; } |