line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::Validator::Schema::ElementRefNode; |
2
|
5
|
|
|
5
|
|
30
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
198
|
|
3
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
183
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
28
|
use base 'XML::Validator::Schema::ElementNode'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
460
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
102
|
use XML::Validator::Schema::Util qw(_err _attr); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
266
|
|
8
|
5
|
|
|
5
|
|
27
|
use Carp qw(croak); |
|
5
|
|
|
|
|
77
|
|
|
5
|
|
|
|
|
1805
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
XML::Validator::Schema::ElementRefNode - an element reference node |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
This is an internal module used by XML::Validator::Schema to represent |
17
|
|
|
|
|
|
|
an element reference node. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub parse { |
22
|
0
|
|
|
0
|
0
|
|
my ($pkg, $data) = @_; |
23
|
0
|
|
|
|
|
|
my $self = $pkg->new(); |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $ref = _attr($data, 'ref'); |
26
|
0
|
0
|
|
|
|
|
croak("Why did you create an ElementRefNode if you didn't have a ref?") |
27
|
|
|
|
|
|
|
unless $ref; |
28
|
0
|
|
|
|
|
|
$self->{unresolved_ref} = 1; |
29
|
0
|
|
|
|
|
|
$self->name($ref); |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $name = _attr($data, 'name'); |
32
|
0
|
0
|
|
|
|
|
_err("Found with illegal combination of 'ref' and 'name' ". |
33
|
|
|
|
|
|
|
"attributes.") |
34
|
|
|
|
|
|
|
if $name; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my $type_name = _attr($data, 'type'); |
37
|
0
|
0
|
|
|
|
|
_err("Found with illegal combination of 'ref' and 'type' ". |
38
|
|
|
|
|
|
|
"attributes.") |
39
|
|
|
|
|
|
|
if $type_name; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $min = _attr($data, 'minOccurs'); |
43
|
0
|
0
|
|
|
|
|
$min = 1 unless defined $min; |
44
|
0
|
0
|
|
|
|
|
_err("Invalid value for minOccurs '$min' found in .") |
45
|
|
|
|
|
|
|
unless $min =~ /^\d+$/; |
46
|
0
|
|
|
|
|
|
$self->{min} = $min; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $max = _attr($data, 'maxOccurs'); |
49
|
0
|
0
|
|
|
|
|
$max = 1 unless defined $max; |
50
|
0
|
0
|
0
|
|
|
|
_err("Invalid value for maxOccurs '$max' found in .") |
51
|
|
|
|
|
|
|
unless $max =~ /^\d+$/ or $max eq 'unbounded'; |
52
|
0
|
|
|
|
|
|
$self->{max} = $max; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return $self; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|