summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-10-25 15:59:59 +0100
committerDaniel Friesel <derf@finalrewind.org>2020-10-25 15:59:59 +0100
commit8eab0da2f889cff51e60ecc5644441ee92c4b012 (patch)
treed8f894c185423e9f8588f1b7fc49e096b29e5e1a
parent717cc78f5a8c34c687eabed6b9e4babd300620a3 (diff)
Oh HAFAS, you so funny3.4.5
-rw-r--r--lib/DBInfoscreen/Helper/HAFAS.pm8
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="... &gt; ..."> is invalid HTML, but present
+ # <SDay text="... &gt; ..."> 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&#042;$2&#042;"}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;
}