Commit 8eab0da2 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Oh HAFAS, you so funny

parent 717cc78f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -99,16 +99,22 @@ sub get_xml_p {

			my $body = decode( 'ISO-8859-15', $tx->res->body );

			# <SDay text="... &gt; ..."> is invalid HTML, but present
			# <SDay text="... &gt; ..."> 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&#042;$2&#042;"}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;
			}