diff options
Diffstat (limited to 'lib/DBInfoscreen/Helper/HAFAS.pm')
-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; } |