Leser: 5
|< 1 2 >| | 19 Einträge, 2 Seiten |
1 2 3 4 5 6 7 8
use strict; use XML::Parser; my $xml = XML::Parser -> new(Style => 'Tree'); my $tree = $xml->parsefile("demo.xml"); use Data::Dumper; print Dumper($tree);
1
2
3
4
5
6
7
8
9
10
11
12
<xml>
<perl>
print "Demo:\n";
</perl>
<window width="300" height="200" xpos="100" ypos="100">
<title>Beispiel</title>
</window>
<perl>
print "Ende.\n";
exit;
</perl>
</xml>
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$VAR1 = [
'xml',
[
{},
0,
'
',
'perl',
[
{},
0,
'
print "Demo:\\n";
'
],
0,
'
',
'window',
[
{
'xpos' => '100',
'width' => '300',
'ypos' => '100',
'height' => '200'
},
0,
'
',
'title',
[
{},
0,
'Beispiel'
],
0,
'
'
],
0,
'
',
'perl',
[
{},
0,
'
print "Ende.\\n";
exit;
'
],
0,
'
'
]
];
print $tree->[0]->[8]->[0]->{'xpos'};
$doc->findnodes("//tag")
|< 1 2 >| | 19 Einträge, 2 Seiten |