Statt getData willst du wahrscheinlich das Ergebnis von textContent().
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
#!/usr/bin/perl
use strict;
use warnings;
use XML::LibXML;
my $file = 'test.xml';
my $parser = XML::LibXML->new();
my $tree = $parser->parse_fh(\*DATA);
my $root = $tree->getDocumentElement();
my @foren = $root->getElementsByTagName('forum');
foreach my $forum(@foren){
print $forum->getAttribute('value'),": ",$forum->textContent(),"\n";
}
_ _ DATA _ _
<foren>
<forum value="1">
http://board.perl-community.de
</forum>
<forum value="2">
http://perlmonks.org
</forum>
</foren>