| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SOAP::WSDL::XSD::SimpleType; |
|
2
|
1
|
|
|
1
|
|
48106
|
use strict; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
69
|
|
|
3
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
64
|
|
|
4
|
1
|
|
|
1
|
|
2336
|
use Class::Std::Fast::Storable; |
|
|
1
|
|
|
|
|
37565
|
|
|
|
1
|
|
|
|
|
10
|
|
|
5
|
1
|
|
|
1
|
|
188
|
use base qw(SOAP::WSDL::Base); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1240
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
10
|
use version; our $VERSION = qv('3.001'); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my %length_of :ATTR(:name :default<[]>); |
|
10
|
|
|
|
|
|
|
my %minLength_of :ATTR(:name :default<[]>); |
|
11
|
|
|
|
|
|
|
my %maxLength_of :ATTR(:name :default<[]>); |
|
12
|
|
|
|
|
|
|
my %pattern_of :ATTR(:name :default<[]>); |
|
13
|
|
|
|
|
|
|
my %enumeration_of :ATTR(:name :default<[]>); |
|
14
|
|
|
|
|
|
|
my %whiteSpace_of :ATTR(:name :default<[]>); |
|
15
|
|
|
|
|
|
|
my %totalDigits_of :ATTR(:name :default<[]>); |
|
16
|
|
|
|
|
|
|
my %fractionDigits_of :ATTR(:name :default<[]>); |
|
17
|
|
|
|
|
|
|
my %minExclusive :ATTR(:name :default<[]>); |
|
18
|
|
|
|
|
|
|
my %minInclusive :ATTR(:name :default<[]>); |
|
19
|
|
|
|
|
|
|
my %maxExclusive :ATTR(:name :default<[]>); |
|
20
|
|
|
|
|
|
|
my %maxInclusive :ATTR(:name :default<[]>); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my %fixed :ATTR(:name :default<[]>); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my %annotation_of :ATTR(:name :default<()>); |
|
25
|
|
|
|
|
|
|
my %base_of :ATTR(:name :default<()>); |
|
26
|
|
|
|
|
|
|
my %itemType_of :ATTR(:name :default<()>); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# TODO rename flavor to variety to be consistent with the XML Schema |
|
30
|
|
|
|
|
|
|
# specs - though flavor is the cooler name.. |
|
31
|
|
|
|
|
|
|
# set to restriction|list|union|enumeration |
|
32
|
|
|
|
|
|
|
my %flavor_of :ATTR(:name :default<()>); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# for simpleType containing atomic simple types |
|
35
|
|
|
|
|
|
|
my %type_of :ATTR(:name :default<()>); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub get_simpleType; *get_simpleType = \&get_type; |
|
38
|
|
|
|
|
|
|
sub set_simpleType; *set_simpleType = \&set_type; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub get_variety; *get_variety = \&get_flavor; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub set_restriction { |
|
43
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
|
44
|
1
|
|
|
|
|
3
|
my @attributes = @_; |
|
45
|
1
|
|
|
|
|
4
|
$self->set_flavor( 'restriction' ); |
|
46
|
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
6
|
for (@attributes) { |
|
48
|
2
|
100
|
|
|
|
7
|
next if (not $_->{ LocalName } eq 'base'); |
|
49
|
1
|
|
|
|
|
5
|
$self->set_base( $_->{ Value } ); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub set_list { |
|
54
|
1
|
|
|
1
|
0
|
16
|
my $self = shift; |
|
55
|
1
|
|
|
|
|
2
|
my @attributes = @_; |
|
56
|
1
|
|
|
|
|
4
|
$self->set_flavor( 'list' ); |
|
57
|
1
|
|
|
|
|
5
|
for (@attributes) { |
|
58
|
2
|
100
|
|
|
|
8
|
next if (not $_->{ LocalName } eq 'itemType'); |
|
59
|
1
|
|
|
|
|
4
|
$self->set_itemType( $_->{ Value } ); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub set_union { |
|
64
|
2
|
|
|
2
|
0
|
891
|
my $self = shift; |
|
65
|
2
|
|
|
|
|
6
|
my @attributes = @_; |
|
66
|
2
|
|
|
|
|
6
|
$self->set_flavor( 'union' ); |
|
67
|
2
|
|
|
|
|
11
|
for (@attributes) { |
|
68
|
4
|
100
|
|
|
|
14
|
next if (not $_->{ LocalName } eq 'memberTypes'); |
|
69
|
2
|
|
|
|
|
13
|
$self->set_base( [ split /\s/, $_->{ Value } ] ); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub serialize { |
|
74
|
4
|
|
|
4
|
0
|
1884
|
my $self = shift; |
|
75
|
4
|
|
|
|
|
6
|
my $name = shift; |
|
76
|
4
|
|
|
|
|
6
|
my $value = shift; |
|
77
|
4
|
|
|
|
|
3
|
my $opt = shift; |
|
78
|
4
|
|
|
|
|
67
|
my $ident = ident $self; |
|
79
|
|
|
|
|
|
|
|
|
80
|
4
|
|
50
|
|
|
46
|
$opt->{ attributes } ||= []; |
|
81
|
4
|
|
50
|
|
|
17
|
$opt->{ indent } ||= q{}; |
|
82
|
|
|
|
|
|
|
|
|
83
|
4
|
100
|
66
|
|
|
31
|
return $self->_serialize_single($name, $value , $opt) |
|
|
|
|
100
|
|
|
|
|
|
84
|
|
|
|
|
|
|
if ( $flavor_of{ $ident } eq 'restriction' |
|
85
|
|
|
|
|
|
|
or $flavor_of{ $ident } eq 'union' |
|
86
|
|
|
|
|
|
|
or $flavor_of{ $ident } eq 'enumeration'); |
|
87
|
|
|
|
|
|
|
|
|
88
|
2
|
100
|
|
|
|
14
|
if ($flavor_of{ $ident } eq 'list' ) |
|
89
|
|
|
|
|
|
|
{ |
|
90
|
1
|
|
50
|
|
|
5
|
$value ||= []; |
|
91
|
1
|
50
|
|
|
|
6
|
$value = [ $value ] if ( ref( $value) ne 'ARRAY' ); |
|
92
|
1
|
|
|
|
|
2
|
return $self->_serialize_single($name, join( q{ }, @{ $value } ), $opt); |
|
|
1
|
|
|
|
|
8
|
|
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _serialize_single { |
|
97
|
3
|
|
|
3
|
|
5
|
my ($self, $name, $value, $opt) = @_; |
|
98
|
3
|
|
|
|
|
5
|
my $xml = ''; |
|
99
|
3
|
50
|
|
|
|
8
|
$xml .= $opt->{ indent } if ($opt->{ readable }); # add indentation |
|
100
|
3
|
|
|
|
|
5
|
$xml .= '<' . join ' ', $name, @{ $opt->{ attributes } }; |
|
|
3
|
|
|
|
|
8
|
|
|
101
|
3
|
50
|
|
|
|
9
|
if ( $opt->{ autotype }) { |
|
102
|
|
|
|
|
|
|
# reverse namespace by prefix hash |
|
103
|
0
|
|
|
|
|
0
|
my $ns = $self->get_targetNamespace(); |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# build a list of hash keys (eg '#default', 'tns') whose values match our namespace (eg 'urn:myNamespace') |
|
106
|
0
|
|
|
|
|
0
|
(my @possible_namespace_names) = grep { $opt->{ namespace }->{$_} eq $ns } keys %{ $opt->{ namespace } }; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# put any '#default' option last |
|
109
|
0
|
0
|
|
|
|
0
|
@possible_namespace_names = sort { $a eq '#default' ? 1 : $b eq '#default' ? -1 : $a cmp $b } @possible_namespace_names; |
|
|
0
|
0
|
|
|
|
0
|
|
|
110
|
|
|
|
|
|
|
|
|
111
|
0
|
0
|
0
|
|
|
0
|
if( grep( $_ ne '#default', @possible_namespace_names ) > 1 or ! @possible_namespace_names ) { |
|
112
|
0
|
|
|
|
|
0
|
die "No prefix found for namespace $ns, or too many possible names: ``@possible_namespace_names''; there should be just one and maybe a '#default' entry"; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
0
|
|
|
|
|
0
|
my $prefix = $possible_namespace_names[0]; |
|
115
|
0
|
|
|
|
|
0
|
$xml .= ' type="' . $prefix . ':' . $self->get_name() .'"'; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# nillabel ? |
|
119
|
3
|
50
|
|
|
|
8
|
return $xml .'/>' if not defined $value; |
|
120
|
|
|
|
|
|
|
|
|
121
|
3
|
|
|
|
|
9
|
$xml .= join q{}, '>' , $value , '' , $name , '>'; |
|
122
|
3
|
50
|
|
|
|
7
|
$xml .= "\n" if ($opt->{ readable }); |
|
123
|
3
|
|
|
|
|
17
|
return $xml; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
1; |