Leser: 2
4 Einträge, 1 Seite |
1
2
3
4
5
<NatuerlichePerson cx:dt="null" cx:ct="struct" _name="NatuerlichePerson">
<geburtsdatum _name="geburtsdatum">19.05.1949<cx:attrib>
<_index cx:dt="int">6</_index>
</cx:attrib>
</geburtsdatum>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
my $twig = new XML::Twig( twig_handlers => { $person => \&getPerson,
$tarif => \&getTarif,
$adresse => \&getAdresse } );
$twig->parsefile( $export{ $docid }->[$FELDER{"XMLPFAD"}] );
.
.
.
sub getPerson{
my( $twig, $pers)= @_;
my %persTree = &getTreeFieldFromHash( $export{$merkDOCID}->[$FELDER{CATEGORYID}], "PERSON", %docsystree );
foreach my $item ( sort keys %persTree ){
if( defined($pers->first_child( $persTree{$item} ))){
$sDummy = encode('iso-8859-1',$pers->first_child( $persTree{$item} )->text);
print LOGFILE $FELDER{$item}."\n";
$export{$merkDOCID}->[$FELDER{$item}] = $sDummy;
}
}
}
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
'first_child' => bless( {
'next_sibling' => bless( {
'parent' => ${$VAR1}->{'first_child'}->{'next_sibling'},
'gi' => '52',
'prev_sibling' => ${$VAR1}->{'first_child'}->{'next_sibling'}->{'first_child'},
'first_child' => bless( {
'parent' => ${$VAR1}->{'first_child'}->{'next_sibling'}->{'first_child'}->{'next_sibling'},
'gi' => '53',
'first_child' => bless( {
'parent' => ${$VAR1}->{'first_child'}->{'next_sibling'}->{'first_child'}->{'next_sibling'}->{'first_child'},
'gi' => 0,
'pcdata' => '5'
}, 'XML::Twig::Elt' ),
'att' => {
'cx:dt' => 'int'
},
'last_child' => ${$VAR1}->{'first_child'}->{'next_sibling'}->{'first_child'}->{'next_sibling'}->{'first_child'}->{'first_child'}
}, 'XML::Twig::Elt' ),
'att' => {},
'last_child' => ${$VAR1}->{'first_child'}->{'next_sibling'}->{'first_child'}->{'next_sibling'}->{'first_child'}
}, 'XML::Twig::Elt' ),
parent' => ${$VAR1}->{'first_child'}->{'next_sibling'},
'gi' => 0,
'pcdata' => '05.09.1943'
}, 'XML::Twig::Elt' ),
'att' => {
'_name' => 'Geburtsdatum'
},
'last_child' => ${$VAR1}->{'first_child'}->{'next_sibling'}->{'first_child'}->{'next_sibling'}
}, 'XML::Twig::Elt' )
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
#!/usr/bin/perl use strict; use warnings; use XML::Twig; use Data::Dumper; my $content = do{ local $/; <DATA> }; my $twig = new XML::Twig( twig_handlers => { 'NatuerlichePerson' => \&getPerson,} ); $twig->parse( $content ); sub getPerson{ my( $twig, $pers)= @_; my $child = $pers->first_child( 'geburtsdatum' ); #$child->cut_children; my $text = join '', map { $_->text if( $_->is_text || (exists $_->{'ent'})) } $child->children; print $text; } __DATA__ <NatuerlichePerson cx:dt="null" cx:ct="struct" _name="NatuerlichePerson"> <geburtsdatum _name="geburtsdatum">19.05.1949<cx:attrib> <_index cx:dt="int">6</_index> </cx:attrib> </geburtsdatum> </NatuerlichePerson>
4 Einträge, 1 Seite |