summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-06-05 14:17:49 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-06-05 14:17:49 +0200
commit9221ddce85fadf1ae98530b524ae81ab726d133e (patch)
tree3eee37754ef2936d7e01bbe67c2d773142c0a809
parent16c1d12373c5e69efc92a11d0b71ef0d41f29572 (diff)
HAFAS: Work around yet another case of invalid XML
-rw-r--r--lib/Travelynx/Helper/HAFAS.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Travelynx/Helper/HAFAS.pm b/lib/Travelynx/Helper/HAFAS.pm
index a7c4abc..84226a4 100644
--- a/lib/Travelynx/Helper/HAFAS.pm
+++ b/lib/Travelynx/Helper/HAFAS.pm
@@ -198,10 +198,14 @@ sub get_xml_p {
$body =~ s{Wagen \d+ \K&}{&amp;};
$body =~ s{Wagen \d+, \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>[...]">.
while ( $body