diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-10-25 16:35:43 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-10-25 16:35:43 +0100 |
commit | c70280a93562e34ad3a711e23d138a96aca5ad58 (patch) | |
tree | 559df272de5a61ec0188039edd69e8d445cb8080 /lib/Travelynx/Helper/HAFAS.pm | |
parent | 76aa233b951787e842bcfa2ebf73db91050e13e7 (diff) |
Merge HAFAS XML fix from DBF1.18.7
Diffstat (limited to 'lib/Travelynx/Helper/HAFAS.pm')
-rw-r--r-- | lib/Travelynx/Helper/HAFAS.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Travelynx/Helper/HAFAS.pm b/lib/Travelynx/Helper/HAFAS.pm index 5253a4e..6aefcf1 100644 --- a/lib/Travelynx/Helper/HAFAS.pm +++ b/lib/Travelynx/Helper/HAFAS.pm @@ -185,12 +185,17 @@ sub get_xml_p { messages => [], }; - # <SDay text="... > ..."> is invalid HTML, but present in + # <SDay text="... > ..."> is invalid XML, but present in # regardless. As it is the last tag, we just throw it away. $body =~ s{<SDay [^>]*/>}{}s; # More fixes for invalid XML $body =~ s{P&R}{P&R}; + + # <Attribute [...] text="[...] "[...]"" /> is invalid XML. + # Work around it. + $body + =~ s{<Attribute([^>]+)text="([^"]*)"([^"=]*)""}{<Attribute$1text="$2*$3*"}s; eval { $tree = XML::LibXML->load_xml( string => $body ) }; if ($@) { $self->{log}->info("load_xml($url): $@"); |