Skip to content
Snippets Groups Projects
Commit 4ee9759f authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

don't fail if element is missing

parent 39e7fc19
No related branches found
No related tags found
No related merge requests found
...@@ -138,12 +138,18 @@ sub parse { ...@@ -138,12 +138,18 @@ sub parse {
my %names = my %names =
map { $_->getAttribute('xml:lang') => $_->textContent() } map { $_->getAttribute('xml:lang') => $_->textContent() }
@names; @names;
$data->{name} = $names{en} ? $names{en} : $names[0]->textContent(); $data->{name} =
$names{en} ? $names{en} :
@names ? $names[0]->textContent() :
undef;
my @urls = $uiinfo->getChildrenByLocalName('InformationURL'); my @urls = $uiinfo->getChildrenByLocalName('InformationURL');
my %urls = my %urls =
map { $_->getAttribute('xml:lang') => $_->textContent() } map { $_->getAttribute('xml:lang') => $_->textContent() }
@urls; @urls;
$data->{url} = $urls{en} ? $urls{en} : $urls[0]->textContent(); $data->{url} =
$urls{en} ? $urls{en} :
@urls ? $urls[0]->textContent() :
undef;
} }
} elsif ($child->localname() eq 'Extensions') { } elsif ($child->localname() eq 'Extensions') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment