| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# $Id: SAX2toSAX1.pm,v 1.3 2002/07/08 11:56:04 matt Exp $ |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package XML::Filter::SAX2toSAX1; |
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
6293
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
77
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use vars qw($VERSION @ISA); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
98
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
1474
|
use XML::SAX::Base; |
|
|
2
|
|
|
|
|
49688
|
|
|
|
2
|
|
|
|
|
619
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
@ISA = qw(XML::SAX::Base); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VERSION = '0.03'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub start_element { |
|
15
|
0
|
|
|
0
|
1
|
|
my ($self, $element) = @_; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# warn("start_element: $self->{Handler}\n"); |
|
18
|
0
|
|
|
|
|
|
$self->make_sax1_attribs($element); |
|
19
|
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $name = delete($element->{LocalName}); |
|
21
|
0
|
|
|
|
|
|
my $prefix = delete($element->{Prefix}); |
|
22
|
0
|
|
|
|
|
|
delete($element->{NamespaceURI}); |
|
23
|
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
$name = "$prefix:$name" if length($prefix); |
|
25
|
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
$element->{Name} = $name; |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
$self->SUPER::start_element($element); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub end_element { |
|
32
|
0
|
|
|
0
|
1
|
|
my ($self, $element) = @_; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# warn("end_element\n"); |
|
35
|
0
|
|
|
|
|
|
delete($element->{Attributes}); |
|
36
|
0
|
|
|
|
|
|
delete($element->{LocalName}); |
|
37
|
0
|
|
|
|
|
|
delete($element->{Prefix}); |
|
38
|
0
|
|
|
|
|
|
delete($element->{NamespaceURI}); |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$self->SUPER::end_element($element); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub make_sax1_attribs { |
|
44
|
0
|
|
|
0
|
0
|
|
my ($self, $element) = @_; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my %attribs; |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
foreach my $attrib (values %{$element->{Attributes}}) { |
|
|
0
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
if (length($attrib->{Prefix})) { |
|
50
|
0
|
|
|
|
|
|
$attribs{"$attrib->{Prefix}:$attrib->{LocalName}"} = |
|
51
|
|
|
|
|
|
|
$attrib->{Value}; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
else { |
|
54
|
0
|
|
|
|
|
|
$attribs{$attrib->{LocalName}} = $attrib->{Value}; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$element->{Attributes} = \%attribs; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
|
62
|
|
|
|
|
|
|
__END__ |