1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?xml version="1.0" encoding="UTF-8"?>
<WHOLE Date="26/05/2011">
<ENTITY Id="1" Type="P" legal_basis="174/2011 (OJ L 49)" reg_date="2011-02-25" pdf_link="http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2011:049:0023:0030:EN:PDF" programme="ZWE" remark="Date of designation referred to in Article 7 (2): 21.2.2002. Head of Government and responsible for activities that seriously undermine democracy, respect for human rights and the rule of law.">
<NAME Id="1" Entity_id="1" legal_basis="898/2005 (OJ L 153)" reg_date="2005-06-16" pdf_link="http://eur-lex.europa.eu/lex/LexUriServ/site/en/oj/2005/l_153/l_15320050616en00090014.pdf" programme="ZWE">
<LASTNAME>Mugabe</LASTNAME>
<FIRSTNAME>Robert</FIRSTNAME>
<MIDDLENAME>Gabriel</MIDDLENAME>
<WHOLENAME />
<GENDER>M</GENDER>
<TITLE />
<FUNCTION>President</FUNCTION>
<LANGUAGE />
</NAME>
<BIRTH Id="1" Entity_id="1" legal_basis="898/2005 (OJ L 153)" reg_date="2005-06-16" pdf_link="http://eur-lex.europa.eu/lex/LexUriServ/site/en/oj/2005/l_153/l_15320050616en00090014.pdf" programme="ZWE">
<DATE>1924-02-21</DATE>
<PLACE />
<COUNTRY />
</BIRTH>
<PASSPORT Id="315" Entity_id="1" legal_basis="77/2009 (OJ L 23)" reg_date="2009-01-27" pdf_link="http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2009:023:0005:0024:EN:PDF" programme="ZWE">
<NUMBER>AD001095</NUMBER>
<COUNTRY />
</PASSPORT>
</ENTITY>
.....
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$parser = XML::LibXML->new();
$EINxml = $parser->parse_file('../data/EU_SanktionGlobal.xml');
# XML Parsen
$daten = $EINxml or die("Lesefehler XML Daten $!\n"); # XML-Testdaten
foreach $EUListe ($daten->findnodes('WHOLE')) {
$ze++;
# Auslesen der Restlichen Werte
# $id = ($root->findnodes('titel'))[0]->textContent:
@ids = ($EUListe->findnodes('./NAME[@Id]'));
$lastname = ($EUListe->findvalue('./NAME/LASTNAME'));
$firstname = ($EUListe->findvalue('./NAME/FIRSTNAME'));
$middlename = ($EUListe->findvalue('./NAME/MIDDLENAME'));
$wholename = ($EUListe->findvalue('./NAME/WHOLENAME'));
$gender = ($EUListe->findvalue('./NAME/GENDER'));
$birthdate = ($EUListe->findvalue('./BIRTH/DATE'));
print "$firstname $lastname $birthdate \n";
}
for my $id ( @ids ) {
print $id->textContent,"\n";
}