| 1 | package W3C::SOAP::XSD::Document; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # Created on: 2012-05-26 15:46:31 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # Create by: Ivan Wills | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # $Id$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # $Revision$, $HeadURL$, $Date$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # $Revision$, $Source$, $Date$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 7 | ▶ | use Carp qw/carp croak cluck confess longmess/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | ▶ | use Scalar::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | ▶ | use List::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | #use List::MoreUtils; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use Data::Dumper qw/Dumper/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 7 | ▶ | use English qw/ -no_match_vars /; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | ▶ | use Path::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 7 | ▶ | use XML::LibXML; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 7 | ▶ | use WWW::Mechanize; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 7 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 7 | ▶ | use URI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 7 | ▶ | use W3C::SOAP::Exception; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 7 | ▶ | use W3C::SOAP::XSD::Document::Element; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 7 | ▶ | use W3C::SOAP::XSD::Document::ComplexType; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 7 | ▶ | use W3C::SOAP::XSD::Document::SimpleType; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 7 | ▶ | use W3C::SOAP::Utils qw/normalise_ns ns2module/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 7 | extends 'W3C::SOAP::Document'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 7 | our $VERSION = 0.13; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 7 | has element_form_default => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | builder => '_element_form_default', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 7 | has imports => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | isa => 'ArrayRef[W3C::SOAP::XSD::Document]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | builder => '_imports', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 7 | has includes => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | isa => 'ArrayRef[W3C::SOAP::XSD::Document]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | builder => '_includes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 7 | has simple_types => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | isa => 'ArrayRef[W3C::SOAP::XSD::Document::SimpleType]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | builder => '_simple_types', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 7 | has simple_type => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | isa => 'HashRef[W3C::SOAP::XSD::Document::SimpleType]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | builder => '_simple_type', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 7 | has anon_simple_type_count => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | isa => 'Int', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | traits => [qw/Counter/], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | default => -1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | handles => { simple_type_count => 'inc' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 7 | has complex_types => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | isa => 'ArrayRef[W3C::SOAP::XSD::Document::ComplexType]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | builder => '_complex_types', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 7 | has complex_type => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | isa => 'HashRef[W3C::SOAP::XSD::Document::ComplexType]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | builder => '_complex_type', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 7 | has anon_complex_type_count => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | isa => 'Int', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | traits => [qw/Counter/], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | default => -1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | handles => { complex_type_count => 'inc' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | clearer => 'reset_complex_type_count', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 7 | has elements => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | isa => 'ArrayRef[W3C::SOAP::XSD::Document::Element]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | builder => '_elements', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 7 | has element => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | isa => 'HashRef[W3C::SOAP::XSD::Document::Element]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | builder => '_element', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 7 | has module => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | builder => '_module', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 7 | has ns_name => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | builder => '_ns_name', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 7 | has ns_map => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | isa => 'HashRef[Str]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | predicate => 'has_ns_map', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | builder => '_ns_map', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | sub _element_form_default { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 12 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_element_form_default: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 12 | my @imports; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 12 | my @nodes = $self->xpc->findnodes('//@elementFormDefault'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 12 | ▶ | if (@nodes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 12 | return $nodes[0]->value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | return 'unqualified'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | sub _imports { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 14 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_imports: called CC=11 SCAR=32.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 14 | my @imports; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 14 | my @nodes = $self->xpc->findnodes('//xsd:import'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 14 | for my $import (@nodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 4 | ▶ | next if $import->getAttribute('namespace') && $import->getAttribute('namespace') eq 'http://www.w3.org/2001/XMLSchema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$import->getAttribute("namespace") and $import->getAttribute("namespace") eq "http://www.w3.org/2001/XMLSchema"
MC/DC0%0/2
$import->getAttribute("namespace") and $import->getAttribute("namespace") eq "http://www.w3.org/2001/XMLSchema"
$import->getAttribute("namespace")
$import->getAttribute("namespace") eq "http://www.w3.org/2001/XMLSchema"
Truth table33%1/3
A and B
A= $import->getAttribute("namespace")B= $import->getAttribute("namespace") eq "http://www.w3.org/2001/XMLSchema"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 4 | ▶ | my $location = $import->getAttribute('schemaLocation') || $import->getAttribute('namespace'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$import->getAttribute('schemaLocation') || $import->getAttribute('namespace')
MC/DC0%0/2
$import->getAttribute('schemaLocation') || $import->getAttribute('namespace')
$import->getAttribute('schemaLocation')
$import->getAttribute('namespace')
Truth table33%1/3
A || B
A= $import->getAttribute('schemaLocation')B= $import->getAttribute('namespace')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 4 | ▶ | if ($location) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 4 | ▶ | if ( $self->location && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$self->location and $self->location =~ m[^(?:https?|ftp)://]msx || -f $self->location && !(-f $location)
$self->location =~ m[^(?:https?|ftp)://]msx or -f $self->location and not -f $location
-f $self->location and not -f $location
MC/DC0%0/4
$self->location and $self->location =~ m[^(?:https?|ftp)://]msx || -f $self->location && !(-f $location)
$self->location
$self->location =~ m[^(?:https?|ftp)://]msx
-f $self->location
not -f $location
Truth table20%1/5
A and B or C and not(D)
A= $self->locationB= $self->location =~ m[^(?:https?|ftp)://]msxC= -f $self->locationD= not -f $location
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | $self->location =~ m{^(?:https?|ftp)://}xms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | || ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | -f $self->location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | && !-f $location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | my $current_location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | = -f $self->location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | ? path($self->location)->absolute . '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | : $self->location; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $location = URI->new_abs($location, $current_location)->as_string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 4 | push @imports, __PACKAGE__->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | location => $location, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | ns_module_map => $self->ns_module_map, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | module_base => $self->module_base, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | warn "Found import but no schemaLocation so no schema imported!\n\t" . $import->toString . "\n\t"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 14 | return \@imports; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | sub _includes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 14 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_includes: called CC=8 SCAR=24.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 14 | my @includes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 14 | my @nodes = $self->xpc->findnodes('//xsd:include'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 14 | for my $include (@nodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 4 | ▶ | next if $include->getAttribute('namespace') && $include->getAttribute('namespace') eq 'http://www.w3.org/2001/XMLSchema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$include->getAttribute("namespace") and $include->getAttribute("namespace") eq "http://www.w3.org/2001/XMLSchema"
MC/DC0%0/2
$include->getAttribute("namespace") and $include->getAttribute("namespace") eq "http://www.w3.org/2001/XMLSchema"
$include->getAttribute("namespace")
$include->getAttribute("namespace") eq "http://www.w3.org/2001/XMLSchema"
Truth table66%2/3
A and B
A= $include->getAttribute("namespace")B= $include->getAttribute("namespace") eq "http://www.w3.org/2001/XMLSchema"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 4 | ▶ | my $location = $include->getAttribute('schemaLocation') || $include->getAttribute('namespace'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$include->getAttribute('schemaLocation') || $include->getAttribute('namespace')
MC/DC0%0/2
$include->getAttribute('schemaLocation') || $include->getAttribute('namespace')
$include->getAttribute('schemaLocation')
$include->getAttribute('namespace')
Truth table33%1/3
A || B
A= $include->getAttribute('schemaLocation')B= $include->getAttribute('namespace')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 4 | ▶ | if ($location) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 4 | ▶ | if ( $self->location && $self->location =~ m{^(?:https?|ftp)://}xms ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->location and $self->location =~ m[^(?:https?|ftp)://]msx
MC/DC0%0/2
$self->location and $self->location =~ m[^(?:https?|ftp)://]msx
$self->location
$self->location =~ m[^(?:https?|ftp)://]msx
Truth table33%1/3
A and B
A= $self->locationB= $self->location =~ m[^(?:https?|ftp)://]msx
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $location = URI->new_abs($location, $self->location)->as_string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 4 | push @includes, __PACKAGE__->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | location => $location, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | ns_module_map => $self->ns_module_map, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | module_base => $self->module_base, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | warn "Found include but no schemaLocation so no schema included!\n\t" . $include->toString . "\n\t"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 14 | return \@includes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | sub _simple_types { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 14 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_simple_types: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 14 | my @simple_types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 14 | my @nodes = $self->xpc->findnodes('//xsd:simpleType'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 14 | for my $node (@nodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 35 | push @simple_types, W3C::SOAP::XSD::Document::SimpleType->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | document => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | node => $node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 14 | return \@simple_types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | sub _simple_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 12 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_simple_type: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 12 | my %simple_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 12 | for my $type (@{ $self->simple_types }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 35 | my $name = $type->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 35 | ▶ | if ( !$name ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 12 | my $parent = $type->node->parentNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 12 | $name = $parent->getAttribute('name'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 12 | ▶ | $name = $name ? $name . '_type' : 'anon'.$self->simple_type_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 12 | $type->name($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 35 | ▶ | confess "No name for simple type ".$type->node->parentNode->toString if !$name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 35 | $simple_type{$name} = $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 12 | return \%simple_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | sub _complex_types { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 14 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_complex_types: called CC=9 SCAR=22.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 14 | my @complex_types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 14 | my @nodes = $self->xpc->findnodes('/*/xsd:complexType'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 14 | push @nodes, $self->xpc->findnodes('/*/xsd:complexContent'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 14 | for my $node (@nodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # get all top level complex types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 20 | ▶ | push @complex_types, W3C::SOAP::XSD::Document::ComplexType->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | document => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | node => $node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | catch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | warn Dumper { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | document => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | node => $node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | die $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 20 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | # now itterate over all document level elements and elements of complex types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 14 | my @elements = ( @{ $self->elements }, map {@{ $_->sequence }} @complex_types ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 14 | ▶ | while ( my $element = shift @elements ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | # Get the elements first sub complex type (if any) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 481 | my ($node) = $self->xpc->findnodes('xsd:complexType', $element->node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 481 | ▶ | if (!$node) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 468 | ($node) = $self->xpc->findnodes('xsd:complexContent', $element->node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 481 | ▶ | next unless $node; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 15 | ▶ | push @complex_types, W3C::SOAP::XSD::Document::ComplexType->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | parent_node => $element, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | document => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | node => $node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 15 | push @elements, @{ $complex_types[-1]->sequence }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | catch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | warn Dumper { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | parent_node => $element->node->toString, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | document => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | node => $node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | die $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 15 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | # Moved the typification of the names in here from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | # the complex_type builder as I can't see why you | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | # wouldn't want the name fixed up front. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 14 | for my $type (@complex_types) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 35 | my $name = $type->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 35 | ▶ | if ( !$name ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 15 | my $parent = $type->node->parentNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 15 | $name = $parent->getAttribute('name'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 15 | ▶ | $name = $name ? $name . 'Type' : 'Anon'.$self->complex_type_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 15 | $type->name($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 35 | ▶ | confess "No name for complex type ".$type->node->parentNode->toString if !$name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 14 | return \@complex_types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | sub _complex_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 9 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_complex_type: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 9 | my %complex_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 9 | for my $type (@{ $self->complex_types }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 28 | my $name = $type->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 28 | $complex_type{$name} = $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 9 | return \%complex_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | sub _elements { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 14 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_elements: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 14 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 14 | my @nodes = $self->xpc->findnodes('/*/xsd:element'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 14 | for my $node (@nodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 36 | push @elements, W3C::SOAP::XSD::Document::Element->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | document => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | node => $node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 14 | return \@elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | sub _element { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_element: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | my %element; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | for my $element (@{ $self->elements }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | $element{$element->name} = $element; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | return \%element; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | sub _ns_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ns_name: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | my %rev = reverse %{ $self->ns_map }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | if ( !defined $rev{$self->target_namespace} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | delete $self->ns_map->{''}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my $ns = $self->target_namespace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $ns =~ s/:/_/gxms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | $rev{$self->target_namespace} = $ns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $self->ns_map->{$ns} = $self->target_namespace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | return $rev{$self->target_namespace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | sub _ns_map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 12 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ns_map: called CC=7 SCAR=20.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | my %map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 32 | ( $_->name =~ /^xmlns:?(.*)$/xms => $_->value ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 12 | $_->name =~ /^xmlns/xms | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | $self->xml->getDocumentElement->getAttributes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 12 | my %rev; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 12 | for my $name ( keys %map ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 32 | ▶ | $rev{$map{$name}} = defined $rev{$map{$name}} ? $rev{$map{$name}} : $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 12 | ▶ | if ( $rev{$self->target_namespace} && $map{''} && $map{''} eq $self->target_namespace ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$rev{$self->target_namespace} and $map{""} and $map{""} eq $self->target_namespace
$rev{$self->target_namespace} and $map{""}
MC/DC0%0/3
$rev{$self->target_namespace} and $map{""} and $map{""} eq $self->target_namespace
$rev{$self->target_namespace}
$map{""}
$map{""} eq $self->target_namespace
Truth table50%2/4
A and B and C
A= $rev{$self->target_namespace}B= $map{""}C= $map{""} eq $self->target_namespace
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | delete $map{''}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 12 | my $ns = $self->target_namespace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 12 | $ns =~ s/:/_/gxms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 12 | ▶ | $map{$ns} = $self->target_namespace if !$rev{$self->target_namespace}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 12 | $map{''} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 12 | return \%map; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | sub get_ns_uri { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 1077 | ▶ | my ($self, $ns_name, $node) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ns_uri: called CC=10 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 1077 | ▶ | confess "No namespace passed when trying to map a namespace uri!\n" if !defined $ns_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 1077 | ▶ | return $self->ns_map->{$ns_name} if $self->ns_map->{$ns_name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | if ( $ns_name =~ /:/xms ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | my $tmp_ns_name = $ns_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | $tmp_ns_name =~ s/:/_/gxms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | return $self->ns_map->{$tmp_ns_name} if $self->ns_map->{$tmp_ns_name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | while ($node) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | my $ns = $node->getAttribute("xmlns:$ns_name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | return $ns if $ns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $ns = $node->getAttribute("targetNamespace"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | return $ns if $ns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | $node = $node->parentNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | last if ref $node eq 'XML::LibXML::Document'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | confess "Couldn't find the namespace '$ns_name' to map\nMap has:\n", Dumper $self->ns_map if !defined $self->ns_map->{$ns_name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | return $self->ns_map->{$ns_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | W3C::SOAP::XSD::Document - Represents a XMLSchema Document | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | This documentation refers to W3C::SOAP::XSD::Document version 0.13. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | use W3C::SOAP::XSD::Document; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | my $xsd = W3C::SOAP::XSD::Document->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | location => 'my.xsd', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | ns_base => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 'http://xml.namespace.com/SomeTing.html' => 'MyApp::SomeTing', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | Takes a XMLSchema Document and makes the contents available in a convenient | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | interface. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | =head1 SUBROUTINES/METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | =item C<get_ns_uri ()> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | =item C<imports> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | =item C<includes> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | =item C<simple_types> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | =item C<simple_type> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | =item C<complex_types> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | =item C<complex_type> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | =item C<elements> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | =item C<element> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | =item C<module> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | =item C<ns_map> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | =item C<ns_module_map> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | =head1 DIAGNOSTICS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | =head1 CONFIGURATION AND ENVIRONMENT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | =head1 DEPENDENCIES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | =head1 INCOMPATIBILITIES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | =head1 BUGS AND LIMITATIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | Please report problems to Ivan Wills (ivan.wills@gmail.com). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | Patches are welcome. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | Ivan Wills - (ivan.wills@gmail.com) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | Copyright (c) 2012 Ivan Wills (14 Mullion Close Hornsby Heights NSW Australia). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | This module is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | the same terms as Perl itself. See L<perlartistic>. This program is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | PARTICULAR PURPOSE. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||