diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-06-05 14:16:51 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-06-05 14:16:51 +0200 |
commit | d34c0f95cbddaca0302535669e8e00524b8ee211 (patch) | |
tree | 3b9470085e20c46fd2f10c5db7dd8bdc3dd8fac8 /lib | |
parent | 2be390cbb3a94c622cf48618f791da1f78b248e0 (diff) |
HAFAS: work around yet another case of invalid XML
Diffstat (limited to 'lib')
-rw-r--r-- | lib/DBInfoscreen/Helper/HAFAS.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm index 84e42c3..3faf3c7 100644 --- a/lib/DBInfoscreen/Helper/HAFAS.pm +++ b/lib/DBInfoscreen/Helper/HAFAS.pm @@ -121,10 +121,14 @@ sub get_xml_p { $body =~ s{P&R}{P&R}; $body =~ s{Wagen \d+ \K&(?= )}{&}; - # <Attribute [...] text="[...] "[...]"" /> is invalid XML. + # <Attribute [...] text="[...]"[...]"" /> is invalid XML. # Work around it. $body - =~ s{<Attribute([^>]+)text="([^"]*)"([^"=]*)""}{<Attribute$1text="$2*$3*"}s; + =~ s{<Attribute([^>]+)text="([^"]*)"([^"=>]*)""}{<Attribute$1text="$2*$3*"}s; + + # Same for <HIMMessage lead="[...]"[...]"[...]" /> + $body + =~ s{<HIMMessage([^>]+)lead="([^"]*)"([^"=>]*)"([^"]*)"}{<Attribute$1text="$2*$3*$4"}s; # Dito for <HIMMessage [...] lead="[...]<br>[...]"> # (replace line breaks with space) |