summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-06-05 14:16:51 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-06-05 14:16:51 +0200
commitd34c0f95cbddaca0302535669e8e00524b8ee211 (patch)
tree3b9470085e20c46fd2f10c5db7dd8bdc3dd8fac8
parent2be390cbb3a94c622cf48618f791da1f78b248e0 (diff)
HAFAS: work around yet another case of invalid XML
-rw-r--r--lib/DBInfoscreen/Helper/HAFAS.pm8
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&amp;R};
$body =~ s{Wagen \d+ \K&(?= )}{&amp;};
- # <Attribute [...] text="[...] "[...]"" /> is invalid XML.
+ # <Attribute [...] text="[...]"[...]"" /> is invalid XML.
# Work around it.
$body
- =~ s{<Attribute([^>]+)text="([^"]*)"([^"=]*)""}{<Attribute$1text="$2&#042;$3&#042;"}s;
+ =~ s{<Attribute([^>]+)text="([^"]*)"([^"=>]*)""}{<Attribute$1text="$2&#042;$3&#042;"}s;
+
+ # Same for <HIMMessage lead="[...]"[...]"[...]" />
+ $body
+ =~ s{<HIMMessage([^>]+)lead="([^"]*)"([^"=>]*)"([^"]*)"}{<Attribute$1text="$2&#042;$3&#042;$4"}s;
# Dito for <HIMMessage [...] lead="[...]<br>[...]">
# (replace line breaks with space)