line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::Essex::NamespaceMap; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = 0.000_1; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
XML::Essex::NamespaceMap - ... |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Contains a mapping of namespaces to prefixes. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 METHODS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=over |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
5355
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
229
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=item new |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $map = ns_map $ns1 => $prefix1, ...; ## In Essex scripts. |
26
|
|
|
|
|
|
|
my $map = XML::Essex::NamespaceMap->new( |
27
|
|
|
|
|
|
|
$essex, |
28
|
|
|
|
|
|
|
$ns1 => $prefix1, |
29
|
|
|
|
|
|
|
... |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
my $unregistered_map = XML::Essex::NamespaceMap->new( |
32
|
|
|
|
|
|
|
$ns1 => $prefix1, |
33
|
|
|
|
|
|
|
... |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new { |
39
|
0
|
|
|
0
|
1
|
|
my $proto = shift; |
40
|
0
|
|
|
|
|
|
my $essex; |
41
|
0
|
0
|
0
|
|
|
|
$essex = shift if @_ && UNIVERSAL::isa( $_[0], "XML::Essex" ); |
42
|
0
|
|
|
|
|
|
my %map = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
0
|
|
|
|
my $self = bless { |
45
|
|
|
|
|
|
|
Essex => $essex, |
46
|
|
|
|
|
|
|
Map => \%map, |
47
|
|
|
|
|
|
|
}, ref $proto || $proto; |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
$self->{Essex}->add_namespace_map( $self->{Map} ) if $self->{Essex}; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub DESTROY { |
55
|
0
|
|
|
0
|
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
if ( $self->{Essex} ) { |
58
|
0
|
|
|
|
|
|
$self->{Essex}->remove_namespace_map( $self->{Map} ); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
else { |
61
|
|
|
|
|
|
|
## Clear out the map in case it was added to an Essex |
62
|
|
|
|
|
|
|
## we don't happen to refer to. |
63
|
0
|
|
|
|
|
|
%{$self->{Map}} = (); |
|
0
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=back |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 LIMITATIONS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
No way to get at the namespaces and prefixes. Can add one when one |
72
|
|
|
|
|
|
|
is needed, most uses should go through the essex object to fall back |
73
|
|
|
|
|
|
|
to earlier mappings if a mapping doesn't happen to have a particular |
74
|
|
|
|
|
|
|
namespace or prefix. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Copyright 2002, R. Barrie Slaymaker, Jr., All Rights Reserved |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 LICENSE |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
You may use this module under the terms of the BSD, Artistic, oir GPL licenses, |
83
|
|
|
|
|
|
|
any version. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Barrie Slaymaker |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |