line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::Validator::Schema::Library; |
2
|
6
|
|
|
6
|
|
36
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
198
|
|
3
|
6
|
|
|
6
|
|
28
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
161
|
|
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
31
|
use XML::Validator::Schema::Util qw(XSD _err); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
295
|
|
6
|
6
|
|
|
6
|
|
33
|
use Carp qw(croak); |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
2840
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
XML::Validator::Schema::TypeLibrary |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Internal base class used to implement a libraries of named items. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
1
|
|
|
1
|
0
|
2
|
my $pkg = shift; |
20
|
1
|
|
|
|
|
5
|
my $self = bless({@_}, $pkg); |
21
|
|
|
|
|
|
|
|
22
|
1
|
50
|
|
|
|
10
|
croak("Missing required 'what' parameter.") |
23
|
|
|
|
|
|
|
unless $self->{what}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# initialize stacks |
26
|
1
|
|
|
|
|
48
|
$self->{stacks} = {}; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
4
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub find_all { |
32
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
33
|
0
|
|
|
|
|
0
|
my @ret; |
34
|
0
|
|
|
|
|
0
|
foreach my $ns (keys %{$self->{stacks}}) { |
|
0
|
|
|
|
|
0
|
|
35
|
0
|
|
|
|
|
0
|
foreach my $name (keys %{$self->{$ns}}) { |
|
0
|
|
|
|
|
0
|
|
36
|
0
|
|
|
|
|
0
|
push @ret, $self->{stacks}{$ns}{$name}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
0
|
|
|
|
|
0
|
return @ret; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub find { |
43
|
196
|
|
|
196
|
0
|
78492
|
my ($self, %arg) = @_; |
44
|
196
|
50
|
|
|
|
454
|
croak("Missing required name parameter.") unless $arg{name}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# HACK: fix when QName resolution works |
47
|
196
|
|
|
|
|
319
|
$arg{name} =~ s!^[^:]*:!!; |
48
|
196
|
|
50
|
|
|
776
|
$arg{ns} ||= XSD; |
49
|
|
|
|
|
|
|
|
50
|
196
|
|
|
|
|
717
|
return $self->{stacks}{$arg{ns}}{$arg{name}}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub add { |
54
|
0
|
|
|
0
|
0
|
|
my ($self, %arg) = @_; |
55
|
0
|
0
|
|
|
|
|
croak("Missing required name parameter.") unless $arg{name}; |
56
|
0
|
0
|
|
|
|
|
croak("Missing required obj parameter.") unless $arg{obj}; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# HACK: fix when QName resolution works |
59
|
0
|
|
|
|
|
|
$arg{name} =~ s!^\w+:!!; |
60
|
0
|
|
0
|
|
|
|
$arg{ns} ||= XSD; |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
_err("Illegal attempt to redefine $self->{what} '$arg{name}' ". |
63
|
|
|
|
|
|
|
"in namespace '$arg{ns}'") |
64
|
|
|
|
|
|
|
if exists $self->{stacks}{$arg{ns}}{$arg{name}}; |
65
|
0
|
|
|
|
|
|
$self->{stacks}{$arg{ns}}{$arg{name}} = $arg{obj}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |