Merge HAFAS XML fix from DBF
This commit is contained in:
parent
76aa233b95
commit
c70280a935
1 changed files with 6 additions and 1 deletions
|
@ -185,12 +185,17 @@ sub get_xml_p {
|
||||||
messages => [],
|
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.
|
# regardless. As it is the last tag, we just throw it away.
|
||||||
$body =~ s{<SDay [^>]*/>}{}s;
|
$body =~ s{<SDay [^>]*/>}{}s;
|
||||||
|
|
||||||
# More fixes for invalid XML
|
# More fixes for invalid XML
|
||||||
$body =~ s{P&R}{P&R};
|
$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 ) };
|
eval { $tree = XML::LibXML->load_xml( string => $body ) };
|
||||||
if ($@) {
|
if ($@) {
|
||||||
$self->{log}->info("load_xml($url): $@");
|
$self->{log}->info("load_xml($url): $@");
|
||||||
|
|
Loading…
Reference in a new issue