| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package XML::SAX::Simple; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
XML::SAX::Simple - SAX version of XML::Simple. |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 VERSION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Version 0.08 |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$VERSION = '0.08'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
7
|
|
|
7
|
|
41224
|
use 5.006; |
|
|
7
|
|
|
|
|
39
|
|
|
16
|
7
|
|
|
7
|
|
46
|
use strict; |
|
|
7
|
|
|
|
|
11
|
|
|
|
7
|
|
|
|
|
271
|
|
|
17
|
7
|
|
|
7
|
|
38
|
use warnings; |
|
|
7
|
|
|
|
|
27
|
|
|
|
7
|
|
|
|
|
271
|
|
|
18
|
7
|
|
|
7
|
|
6627
|
use Data::Dumper; |
|
|
7
|
|
|
|
|
74129
|
|
|
|
7
|
|
|
|
|
585
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
7
|
|
|
7
|
|
56
|
use vars qw(@EXPORT); |
|
|
7
|
|
|
|
|
12
|
|
|
|
7
|
|
|
|
|
423
|
|
|
21
|
7
|
|
|
7
|
|
3980
|
use XML::SAX; |
|
|
7
|
|
|
|
|
34937
|
|
|
|
7
|
|
|
|
|
345
|
|
|
22
|
7
|
|
|
7
|
|
4425
|
use XML::Handler::Trees; |
|
|
7
|
|
|
|
|
24373
|
|
|
|
7
|
|
|
|
|
207
|
|
|
23
|
7
|
|
|
7
|
|
48
|
use base 'XML::Simple'; |
|
|
7
|
|
|
|
|
12
|
|
|
|
7
|
|
|
|
|
6846
|
|
|
24
|
|
|
|
|
|
|
@EXPORT = qw(XMLin XMLout); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
C is a very simple version of L but for SAX.It can |
|
29
|
|
|
|
|
|
|
be used as a complete drop-in replacement for L. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
See the documentation for L for details. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
use XML::SAX::Simple qw(XMLin XMLout); |
|
36
|
|
|
|
|
|
|
my $hash = XMLin("foo.xml"); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub XMLin { |
|
41
|
100
|
|
|
100
|
1
|
8193752
|
my $self; |
|
42
|
|
|
|
|
|
|
|
|
43
|
100
|
100
|
100
|
|
|
1763
|
if ($_[0] and UNIVERSAL::isa($_[0], 'XML::Simple')) { |
|
44
|
5
|
|
|
|
|
11
|
$self = shift; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
else { |
|
47
|
95
|
|
|
|
|
512
|
$self = XML::SAX::Simple->new(); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
100
|
|
|
|
|
4779
|
$self->SUPER::XMLin(@_); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub XMLout { |
|
54
|
49
|
|
|
49
|
1
|
117028
|
my $self; |
|
55
|
|
|
|
|
|
|
|
|
56
|
49
|
100
|
66
|
|
|
393
|
if ($_[0] and UNIVERSAL::isa($_[0], 'XML::Simple')) { |
|
57
|
2
|
|
|
|
|
3
|
$self = shift; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
else { |
|
60
|
47
|
|
|
|
|
227
|
$self = XML::SAX::Simple->new(); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
49
|
|
|
|
|
2090
|
$self->SUPER::XMLout(@_); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub build_tree { |
|
67
|
92
|
|
|
92
|
0
|
12318
|
my ($self, $filename, $string) = @_; |
|
68
|
|
|
|
|
|
|
|
|
69
|
92
|
|
|
|
|
157
|
$self->{nocollapse} = 1; |
|
70
|
|
|
|
|
|
|
|
|
71
|
92
|
50
|
66
|
|
|
312
|
if ($filename and $filename eq '-') { |
|
72
|
0
|
|
|
|
|
0
|
local($/); |
|
73
|
0
|
|
|
|
|
0
|
$string = ; |
|
74
|
0
|
|
|
|
|
0
|
$filename = undef; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
92
|
|
|
|
|
571
|
my $handler = XML::Handler::Tree->new(); |
|
78
|
92
|
|
|
|
|
852
|
my $parser = XML::SAX::ParserFactory->parser(Handler => $handler); |
|
79
|
|
|
|
|
|
|
|
|
80
|
92
|
|
|
|
|
404375
|
my $tree; |
|
81
|
|
|
|
|
|
|
|
|
82
|
92
|
100
|
|
|
|
297
|
if ($filename) { |
|
83
|
15
|
|
|
|
|
109
|
$tree = $parser->parse_uri($filename); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
else { |
|
86
|
77
|
100
|
66
|
|
|
427
|
if (ref($string) && ref($string) ne 'SCALAR') { |
|
87
|
1
|
|
|
|
|
8
|
$tree = $parser->parse_file($string); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
else { |
|
90
|
76
|
|
|
|
|
250
|
$tree = $parser->parse_string($$string); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
92
|
|
|
|
|
1585838
|
return $tree; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 AUTHOR |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Matt Sergeant, matt@sergeant.org |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Currently maintained by Mohammad S Anwar (MANWAR), C<< >> |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 REPOSITORY |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L, L. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This is free software. You may use it and distribute it under the same terms as |
|
114
|
|
|
|
|
|
|
Perl itself. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Copyright (C) 2001 Matt Sergeant, matt@sergeant.org |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; # end of XML::SAX::Simple |