line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CAM::XML::XMLTree; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
426
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.14'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
CAM::XML::Text - XML text nodes |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 LICENSE |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Copyright 2006 Clotho Advanced Media, Inc., |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it |
17
|
|
|
|
|
|
|
under the same terms as Perl itself. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This is a modified copy of XML::Parser::Tree from XML/Parser.pm |
22
|
|
|
|
|
|
|
v2.30. It differs from the original in that each object is one |
23
|
|
|
|
|
|
|
hashref instead of one scalar and one scalar/arrayref in the |
24
|
|
|
|
|
|
|
object list. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 FUNCTIONS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=over |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=item Init() |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub Init |
35
|
|
|
|
|
|
|
{ |
36
|
0
|
|
|
0
|
1
|
|
my $expat = shift; |
37
|
0
|
|
|
|
|
|
$expat->{Stack} = []; |
38
|
0
|
|
|
|
|
|
$expat->{Package} = 'CAM::XML'; |
39
|
0
|
|
|
|
|
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item Start($tag) |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub Start |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
0
|
1
|
|
my $expat = shift; |
49
|
0
|
|
|
|
|
|
my $tag = shift; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $obj = $expat->{Package}->new($tag, @_); |
52
|
0
|
0
|
|
|
|
|
if (!$expat->{Base}) |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
|
|
|
$expat->{Base} = $obj; |
55
|
|
|
|
|
|
|
} |
56
|
0
|
0
|
|
|
|
|
if (@{ $expat->{Stack} } > 0) |
|
0
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
{ |
58
|
0
|
|
|
|
|
|
$expat->{Stack}->[-1]->add($obj); |
59
|
|
|
|
|
|
|
} |
60
|
0
|
|
|
|
|
|
push @{ $expat->{Stack} }, $obj; |
|
0
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item End($tag) |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub End |
69
|
|
|
|
|
|
|
{ |
70
|
0
|
|
|
0
|
1
|
|
my $expat = shift; |
71
|
0
|
|
|
|
|
|
my $tag = shift; |
72
|
0
|
|
|
|
|
|
pop @{ $expat->{Stack} }; |
|
0
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
delete $expat->{Cdata}; |
74
|
0
|
|
|
|
|
|
return; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item Char($text) |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub Char |
82
|
|
|
|
|
|
|
{ |
83
|
0
|
|
|
0
|
1
|
|
my $expat = shift; |
84
|
0
|
|
|
|
|
|
my $text = shift; |
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
$expat->{Stack}->[-1] |
87
|
|
|
|
|
|
|
->add(($expat->{Cdata} ? '-cdata' : '-text') => $text); |
88
|
0
|
|
|
|
|
|
return; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item CdataStart() |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub CdataStart |
96
|
|
|
|
|
|
|
{ |
97
|
0
|
|
|
0
|
1
|
|
my $expat = shift; |
98
|
0
|
|
|
|
|
|
$expat->{Cdata} = 1; |
99
|
0
|
|
|
|
|
|
return; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item CdataEnd() |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub CdataEnd |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
0
|
1
|
|
my $expat = shift; |
109
|
0
|
|
|
|
|
|
delete $expat->{Cdata}; |
110
|
0
|
|
|
|
|
|
return; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item Final() |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub Final |
118
|
|
|
|
|
|
|
{ |
119
|
0
|
|
|
0
|
1
|
|
my $expat = shift; |
120
|
0
|
|
|
|
|
|
delete $expat->{Stack}; |
121
|
0
|
|
|
|
|
|
return delete $expat->{Base}; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
125
|
|
|
|
|
|
|
__END__ |