1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use strict;
use warnings;
use Encode;
use Data::Dumper;
use XML::Twig;
my $person = "Abrechnungsstelle/Adresse";
my $twig = new XML::Twig( twig_handlers => { $adresse => \&getAdresse,
} );
$twig->parsefile("test.xml");
#if( $twig->safe_parsefile($export{ $docid }->[$FELDER{"XMLPFAD"}]) == 0 ){
# die "Failed to parse $export{ $docid }->[$FELDER{\"XMLPFAD\"}]: $@";
#}
$twig->purge;
1;
sub getAdresse{ #( $twig, $adress )
my( $twig, $adress)= @_;
my %adressTree = ("ORT" => "ort");
my $sDummy = "";
if( defined($adress->first_child( "ort" ))){
my $adressChild = $adress->first_child( "ort" );
my $adresstext = join '', map { $_->text if( $_->is_text || (exists $_->{'ent'})) } $adressChild->children;
$sDummy = encode('iso-8859-1', $adresstext );
print $sDummy."\n";
}
}