Thread XML::Twig Out of Memory (3 answers)
Opened by nyjo at 2011-09-12 10:20

nyjo
 2011-09-13 14:12
#152338 #152338
User since
2005-01-11
17 Artikel
BenutzerIn
[Homepage] [default_avatar]
Hallo,

hier die abgespeckte Version (ergibt den gleichen Fehler)!

Code: (dl )
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";
}
}

Last edited: 2011-09-14 21:22:53 +0200 (CEST)
alles wird gut

---

mfg

Joachim Nyenhuis

View full thread XML::Twig Out of Memory