| 1 | # Copyrights 2006-2024 by [Mark Overmeer <markov@cpan.org>]. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.03. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # This code is part of distribution XML-Compile. Meta-POD processed with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # OODoc into POD and HTML manual-pages. See README.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright Mark Overmeer. Licensed under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | package XML::Compile::Translate;{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 50 | our $VERSION = '1.64'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 50 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 50 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 50 | ▶ | no warnings 'recursion'; # trees can be quite deep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # Errors are either in _class 'usage': called with request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # or 'schema': syntax error in schema | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 50 | ▶ | use Log::Report 'xml-compile', syntax => 'SHORT'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 50 | ▶ | use List::Util qw/first max/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 50 | ▶ | use XML::Compile::Schema::Specs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 50 | ▶ | use XML::Compile::Schema::BuiltInFacets; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 50 | ▶ | use XML::Compile::Schema::BuiltInTypes qw/%builtin_types/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 50 | ▶ | use XML::Compile::Util qw/pack_type unpack_type type_of_node SCHEMA2001 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 50 | unpack_id/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 50 | ▶ | use XML::Compile::Iterator (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 50 | my %translators = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | ( READER => 'XML::Compile::Translate::Reader' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | , WRITER => 'XML::Compile::Translate::Writer' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | , TEMPLATE => 'XML::Compile::Translate::Template' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # Elements from the schema to ignore: remember, we are collecting data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # from the schema, but only use selective items to produce processors. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # All the sub-elements of these will be ignored automatically | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # Don't known whether we ever need the notation... maybe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 50 | my $assertions = qr/assert|report/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 50 | my $id_constraints = qr/unique|key|keyref/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 50 | my $ignore_elements = qr/^(?:notation|annotation|$id_constraints|$assertions)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 50 | my $particle_blocks = qr/^(?:sequence|choice|all|group)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 50 | my $attribute_defs = qr/^(?:attribute|attributeGroup|anyAttribute)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | sub new($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 779 | ▶ | { my ($baseclass, $trans) = (shift, shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 779 | ▶ | my $class = $translators{$trans} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | or error __x"translator back-end {name} not defined", name => $trans; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 779 | eval "require $class"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 779 | ▶ | fault $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 779 | (bless {}, $class)->init( {@_} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | sub init($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 779 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 779 | ▶ | $self->{nss} = $args->{nss} or panic "no namespace tables"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 779 | ▶ | $self->{prefixes} = $args->{prefixes} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'prefixes'} || {}
MC/DC0%0/1
$args->{'prefixes'} || {}
$args->{'prefixes'}
Truth table50%1/2
A
A= $args->{'prefixes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 779 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | sub register($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | { my ($class, $name) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | UNIVERSAL::isa($class, __PACKAGE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | or error __x"back-end {class} does not extend {base}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | , class => $class, base => __PACKAGE__; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | $translators{$name} = $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # may disappear, so not documented publicly (yet) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub actsAs($) { panic "not implemented" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
actsAs: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | #-------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | sub compile($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 779 | ▶ | { my ($self, $item, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile: called CC=10 SCAR=24.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 779 | @$self{keys %args} = values %args; # dirty. Always all the same fields | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 779 | ▶ | my $path = $self->prefixed($item, 1) || $item; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->prefixed($item, 1) || $item
MC/DC0%0/2
$self->prefixed($item, 1) || $item
$self->prefixed($item, 1)
$item
Truth table66%2/3
A || B
A= $self->prefixed($item, 1)B= $item
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 779 | ▶ | ref $item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | and panic "expecting an item as point to start at $path"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 779 | ▶ | my $hooks = $self->{hooks} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"hooks"} ||= []
MC/DC100%1/1
$self->{"hooks"} ||= []
$self->{"hooks"}
Truth table100%2/2
A
A= $self->{"hooks"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 779 | ▶ | my $typemap = $self->{typemap} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"typemap"} ||= {}
MC/DC100%1/1
$self->{"typemap"} ||= {}
$self->{"typemap"}
Truth table100%2/2
A
A= $self->{"typemap"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 779 | $self->typemapToHooks($hooks, $typemap); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | $self->{blocked_nss} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 779 | = $self->decodeBlocked(delete $self->{block_namespace}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 779 | my $nsp = $self->namespaces; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 779 | foreach my $t (keys %$typemap) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 9 | ▶ | { $nsp->find(complexType => $t) || $nsp->find(simpleType => $t) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nsp->find("complexType", $t) or $nsp->find("simpleType", $t)
MC/DC0%0/2
$nsp->find("complexType", $t) or $nsp->find("simpleType", $t)
$nsp->find("complexType", $t)
$nsp->find("simpleType", $t)
Truth table33%1/3
A or B
A= $nsp->find("complexType", $t)B= $nsp->find("simpleType", $t)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | or error __x"complex or simpleType {type} for typemap unknown" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | , type => $t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 779 | ▶ | if(my $def = $self->namespaces->findID($item)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | { my $node = $def->{node}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my $name = $node->localName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $item = $def->{full}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 779 | delete $self->{_created}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 779 | my $produce = $self->topLevel($path, $item, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 777 | delete $self->{_created}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | my $in = $self->{include_namespaces} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 777 | ▶ | or return $produce; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 121 | $self->makeWrapperNs($path, $produce, $self->{prefixes}, $in); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | sub assertType($$$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 2170 | ▶ | { my ($self, $where, $field, $type, $value) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
assertType: called CC=3 SCAR=13.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2170 | my $checker = $builtin_types{$type}{check}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 2170 | ▶ | unless(defined $checker) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | { mistake "useless assert for type $type"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 2170 | ▶ | return if $checker->($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | error __x"field {field} contains '{value}' which is not a valid {type} at {where}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | , field => $field, value => $value, type => $type, where => $where | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | , _class => 'usage'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | sub extendAttrs($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 54 | ▶ | { my ($self, $in, $add) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extendAttrs: called CC=7 SCAR=19.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 54 | ▶ | if(my $a = $add->{attrs}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | { # new attrs overrule old definitions (restrictions) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 54 | my (@attrs, %code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 54 | ▶ | my @all = (@{$in->{attrs} || []}, @{$add->{attrs} || []}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%3/4
$in->{'attrs'} || []
$add->{'attrs'} || []
MC/DC100%1/1
$in->{'attrs'} || []
$in->{'attrs'}
MC/DC0%0/1
$add->{'attrs'} || []
$add->{'attrs'}
Truth table100%2/2
A
A= $in->{'attrs'}
Truth table50%1/2
A
A= $add->{'attrs'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 54 | ▶ | while(@all) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 80 | { my ($type, $code) = (shift @all, shift @all); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 80 | ▶ | if($code{$type}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | { $attrs[$code{$type}] = $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 80 | { push @attrs, $type => $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 80 | $code{$type} = $#attrs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 54 | $in->{attrs} = \@attrs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # doing this correctly is too complex for now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 54 | ▶ | unshift @{$in->{attrs_any}}, @{$add->{attrs_any}} if $add->{attrs_any}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 54 | $in; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 2500 | ▶ | sub isTrue($) { $_[1] eq '1' || $_[1] eq 'true' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isTrue: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # Find the namespace use details of a certain top-level element or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # attribute. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | sub nsContext($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 2081 | ▶ | { my ($self, $def) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nsContext: called CC=16 SCAR=30.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 2081 | ▶ | $def or return {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 2081 | my $tns = $def->{ns}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | # top elements are to be qualified unless there is no targetNamespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 2081 | ▶ | my %context = (tns => $tns, qual_top => ($tns ? 1 : 0)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 2081 | my $el_qual = $def->{efd} eq 'qualified'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 2081 | ▶ | if(exists $self->{elements_qualified}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1843 | ▶ | { my $qual = $self->{elements_qualified} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'elements_qualified'} || 0
MC/DC0%0/1
$self->{'elements_qualified'} || 0
$self->{'elements_qualified'}
Truth table50%1/2
A
A= $self->{'elements_qualified'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1843 | ▶ | if($qual eq 'TOP') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | { $tns or error __x"application requires that element `{name}' has a targetNamespace" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | , name => $def->{full}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1843 | ▶ | { $el_qual = $qual eq 'ALL' ? 1 : $qual eq 'NONE' ? 0 : $qual; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1843 | ▶ | $context{qual_top} = 0 if $qual eq 'NONE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 2081 | $context{qual_elem} = $el_qual; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 2081 | my $at_qual = $def->{afd} eq 'qualified'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 2081 | ▶ | if(exists $self->{attributes_qualified}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 22 | ▶ | { my $qual = $self->{attributes_qualified} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'attributes_qualified'} || 0
MC/DC0%0/1
$self->{'attributes_qualified'} || 0
$self->{'attributes_qualified'}
Truth table50%1/2
A
A= $self->{'attributes_qualified'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 22 | ▶ | if($qual eq 'TOP') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | { $tns or error __x"application requires that attibute `{name}' has a targetNamespace", name => $def->{full}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 22 | ▶ | { $at_qual = $qual eq 'ALL' ? 1 : $qual eq 'NONE' ? 0 : $qual; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 2081 | $context{qual_attr} = $at_qual; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 2081 | \%context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 5031 | ▶ | sub namespaces() { $_[0]->{nss} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
namespaces: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | sub topLevel($$;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 779 | ▶ | { my ($self, $path, $fullname, $is_root) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
topLevel: called CC=10 SCAR=23.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # built-in types have to be handled differently. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | my $internal = XML::Compile::Schema::Specs->builtInType(undef, $fullname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | , sloppy_integers => $self->{sloppy_integers} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | , sloppy_floats => $self->{sloppy_floats} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | , json_friendly => $self->{json_friendly} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 779 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 779 | ▶ | if($internal) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | { my $builtin = $self->makeBuiltin($fullname, undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 2 | , $fullname, $internal, $self->{check_values}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | my $builder = $self->actsAs('WRITER') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 1 | ▶ | ? sub { $_[0]->createTextNode($builtin->(@_)) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 2 | ▶ | : $builtin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 2 | return $self->makeElementWrapper($path, $builder); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 777 | my $nss = $self->namespaces; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 777 | ▶ | my $top = $nss->find(element => $fullname) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$nss->find('element', $fullname) || $nss->find('attribute', $fullname)
MC/DC0%0/2
$nss->find('element', $fullname) || $nss->find('attribute', $fullname)
$nss->find('element', $fullname)
$nss->find('attribute', $fullname)
Truth table66%2/3
A || B
A= $nss->find('element', $fullname)B= $nss->find('attribute', $fullname)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | || $nss->find(attribute => $fullname) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | or error __x(( $fullname eq $path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | ? N__"cannot find element or attribute `{name}'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | : N__"cannot find element or attribute `{name}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | ), name => $fullname, where => $path, _class => 'usage'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | # filter the nodes in the schema which are to be processed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 777 | my $node = $top->{node}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 777 | my $schemans = $node->namespaceURI; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | my $tree = XML::Compile::Iterator->new($node, $path, sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 9135 | ▶ | { my $n = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 9135 | ▶ | $n->isa('XML::LibXML::Element') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$n->isa("XML::LibXML::Element") and $n->namespaceURI eq $schemans
MC/DC50%1/2
$n->isa("XML::LibXML::Element") and $n->namespaceURI eq $schemans
$n->isa("XML::LibXML::Element")
$n->namespaceURI eq $schemans
Truth table66%2/3
A and B
A= $n->isa("XML::LibXML::Element")B= $n->namespaceURI eq $schemans
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | && $n->namespaceURI eq $schemans | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | && $n->localName !~ $ignore_elements | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 777 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 777 | delete $self->{_nest}; # reset recursion administration | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 777 | local $self->{_context} = $self->nsContext($top); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 777 | my $name = $node->localName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 777 | my $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 777 | ▶ | if($name eq 'element') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 769 | { my ($label, $make) = $self->element($tree, $is_root); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 767 | ▶ | $data = $self->makeElementWrapper($path, $make) if $make; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | elsif($name eq 'attribute') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 8 | { my $make = $self->attribute($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 8 | ▶ | $data = $self->makeAttributeWrapper($path, $make) if $make; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | { error __x"top-level `{full}' is not an element or attribute but {name} at {where}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | , full => $fullname, name => $name, where => $tree->path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | , _class => 'usage'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 775 | $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | sub typeByName($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 1993 | ▶ | { my ($self, $where, $tree, $typename) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
typeByName: called CC=6 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1993 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | # Try to detect a built-in type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | my $def = XML::Compile::Schema::Specs->builtInType($node, $typename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | , sloppy_integers => $self->{sloppy_integers} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | , sloppy_floats => $self->{sloppy_floats} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | , json_friendly => $self->{json_friendly} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 1993 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 1993 | ▶ | if($def) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | { # Is built-in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 1611 | my $st = $self->makeBuiltin($where, $node, $typename, $def, $self->{check_values}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 1611 | return +{ st => $st, is_list => $def->{is_list} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | # not a schema standard type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 382 | ▶ | my $top = $self->namespaces->find(complexType => $typename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->namespaces->find('complexType', $typename) || $self->namespaces->find('simpleType', $typename)
MC/DC0%0/2
$self->namespaces->find('complexType', $typename) || $self->namespaces->find('simpleType', $typename)
$self->namespaces->find('complexType', $typename)
$self->namespaces->find('simpleType', $typename)
Truth table66%2/3
A || B
A= $self->namespaces->find('complexType', $typename)B= $self->namespaces->find('simpleType', $typename)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | || $self->namespaces->find(simpleType => $typename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | or error __x"cannot find type {type} at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | , type => $typename, where => $where, _class => 'usage'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 382 | local $self->{_context} = $self->nsContext($top); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 382 | my $typeimpl = $tree->descend($top->{node}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 382 | my $typedef = $top->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 382 | ▶ | $typedef eq 'simpleType' ? $self->simpleType($typeimpl) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | : $typedef eq 'complexType' ? $self->complexType($typeimpl) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | : error __x"expecting simple- or complexType, not '{type}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | , type => $typedef, where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | sub simpleType($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 372 | ▶ | { my ($self, $tree, $in_list) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
simpleType: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 372 | ▶ | $tree->nrChildren==1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | or error __x"simpleType must have exactly one child at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | , where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 372 | my $child = $tree->firstChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 372 | my $name = $child->localName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 372 | my $nest = $tree->descend($child); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | # Full content: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # annotation? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | # , (restriction | list | union) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 372 | ▶ | my $type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | = $name eq 'restriction' ? $self->simpleRestriction($nest, $in_list) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | : $name eq 'list' ? $self->simpleList($nest) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | : $name eq 'union' ? $self->simpleUnion($nest) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | : error __x"simpleType contains '{local}', must be restriction, list, or union at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | , local => $name, where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 372 | delete @$type{'attrs','attrs_any'}; # spec says ignore attrs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 372 | $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | sub simpleList($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 56 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
simpleList: called CC=7 SCAR=20.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | # attributes: id, itemType = QName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | # content: annotation?, simpleType? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 56 | my $per_item; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 56 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 56 | my $where = $tree->path . '#list'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 56 | ▶ | if(my $type = $node->getAttribute('itemType')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 40 | ▶ | { $tree->nrChildren==0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | or error __x"list with both itemType and content at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 40 | my $typename = $self->rel2abs($where, $node, $type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 40 | ▶ | $per_item = $self->blocked($where, simpleType => $typename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->blocked($where, 'simpleType', $typename) || $self->typeByName($where, $tree, $typename)
MC/DC0%0/2
$self->blocked($where, 'simpleType', $typename) || $self->typeByName($where, $tree, $typename)
$self->blocked($where, 'simpleType', $typename)
$self->typeByName($where, $tree, $typename)
Truth table33%1/3
A || B
A= $self->blocked($where, 'simpleType', $typename)B= $self->typeByName($where, $tree, $typename)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | || $self->typeByName($where, $tree, $typename); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 16 | ▶ | { $tree->nrChildren==1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | or error __x"list expects one simpleType child at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 16 | ▶ | $tree->currentLocal eq 'simpleType' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | or error __x"list can only have a simpleType child at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 16 | $per_item = $self->simpleType($tree->descend, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | my $st = $per_item->{st} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 56 | ▶ | or panic "list did not produce a simple type at $where"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 56 | $per_item->{st} = $self->makeList($where, $st); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 56 | $per_item->{is_list} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 56 | $per_item; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | sub simpleUnion($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 37 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
simpleUnion: called CC=7 SCAR=19.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | # attributes: id, memberTypes = List of QName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | # content: annotation?, simpleType* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 37 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 37 | my $where = $tree->path . '#union'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | # Normal error handling switched off, and check_values must be on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | # When check_values is off, we may decide later to treat that as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | # string, which is faster but not 100% safe, where int 2 may be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | # formatted as float 1.999 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 37 | local $self->{check_values} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 37 | my @types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 37 | ▶ | if(my $members = $node->getAttribute('memberTypes')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 27 | { foreach my $union (split " ", $members) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 43 | { my $typename = $self->rel2abs($where, $node, $union); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 43 | ▶ | my $type = $self->blocked($where, simpleType => $typename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->blocked($where, 'simpleType', $typename) || $self->typeByName($where, $tree, $typename)
MC/DC0%0/2
$self->blocked($where, 'simpleType', $typename) || $self->typeByName($where, $tree, $typename)
$self->blocked($where, 'simpleType', $typename)
$self->typeByName($where, $tree, $typename)
Truth table33%1/3
A || B
A= $self->blocked($where, 'simpleType', $typename)B= $self->typeByName($where, $tree, $typename)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | || $self->typeByName($where, $tree, $typename); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | my $st = $type->{st} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 43 | ▶ | or error __x"union only of simpleTypes, but {type} is complex at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | , type => $typename, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 43 | push @types, $st; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 37 | foreach my $child ($tree->childs) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 39 | { my $name = $child->localName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 39 | ▶ | $name eq 'simpleType' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | or error __x"only simpleType's within union, found {local} at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | , local => $name, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 39 | my $ctype = $self->simpleType($tree->descend($child), 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 39 | push @types, $ctype->{st}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 37 | my $do = $self->makeUnion($where, @types); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 37 | { st => $do, is_union => 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | sub simpleRestriction($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 279 | ▶ | { my ($self, $tree, $in_list) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
simpleRestriction: called CC=10 SCAR=31.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | # attributes: id, base = QName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | # content: annotation?, simpleType?, facet* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 279 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 279 | my $where = $tree->path . '#sres'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 279 | my ($base, $typename); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 279 | ▶ | if(my $basename = $node->getAttribute('base')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 279 | { $typename = $self->rel2abs($where, $node, $basename); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 279 | ▶ | $base = $self->blocked($where, simpleType => $typename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->blocked($where, 'simpleType', $typename) || $self->typeByName($where, $tree, $typename)
MC/DC0%0/2
$self->blocked($where, 'simpleType', $typename) || $self->typeByName($where, $tree, $typename)
$self->blocked($where, 'simpleType', $typename)
$self->typeByName($where, $tree, $typename)
Truth table66%2/3
A || B
A= $self->blocked($where, 'simpleType', $typename)B= $self->typeByName($where, $tree, $typename)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | || $self->typeByName($where, $tree, $typename); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | { my $simple = $tree->firstChild | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | or error __x"no base in simple-restriction, so simpleType required at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | $simple->localName eq 'simpleType' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | or error __x"simpleType expected, because there is no base attribute at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $base = $self->simpleType($tree->descend($simple, 'st')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | if((my $r) = $simple->getChildrenByLocalName('restriction')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | # <simpleType><restriction><simpleType><restriction base=xxx></simpleType>@facets</simpleType> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | my $basename = $r->getAttribute('base'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | $typename = $self->rel2abs($where, $r, $basename) if $r; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $tree->nextChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | my $st = $base->{st} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 279 | ▶ | or error __x"simple-restriction is not a simpleType at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | my $do = $self->applySimpleFacets($tree, $st | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 279 | ▶ | , $in_list || $base->{is_list}, $typename); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$in_list || $base->{'is_list'}
MC/DC100%2/2
$in_list || $base->{'is_list'}
$in_list
$base->{'is_list'}
Truth table100%3/3
A || B
A= $in_listB= $base->{'is_list'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 279 | ▶ | $tree->currentChild | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | and error __x"elements left at tail at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | , where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 279 | +{ st => $do }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | # Early=lexical space, Late=value space | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 50 | my %facets_early = map +($_ => 1), qw/whiteSpace pattern/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | #my %facets_late = map +($_ => 1), qw/totalDigits maxScale minScale enumeration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # maxInclusive maxExclusive minInclusive minExclusive fractionDigits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # length minLength maxLength/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 50 | my $qname_type = pack_type SCHEMA2001, 'QName'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | sub applySimpleFacets($$$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 287 | ▶ | { my ($self, $tree, $st, $is_list, $type) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
applySimpleFacets: called CC=19 SCAR=29.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 287 | my $nss = $self->{nss}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | # partial | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | # content: facet* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | # facet = minExclusive | minInclusive | maxExclusive | maxInclusive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # | totalDigits | fractionDigits | maxScale | minScale | length | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | # | minLength | maxLength | enumeration | whiteSpace | pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 287 | my $where = $tree->path . '#facet'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 287 | my (%facets, $is_qname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 287 | ▶ | for(my $child = $tree->currentChild; $child; $child = $tree->nextChild) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 280 | { my $facet = $child->localName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 280 | ▶ | last if $facet =~ $attribute_defs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 272 | my $value = $child->getAttribute('value'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 272 | ▶ | defined $value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | or error __x"no value for facet `{facet}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | , facet => $facet, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 272 | ▶ | if($facet eq 'enumeration') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 88 | ▶ | { $is_qname = $nss->doesExtend($type, $qname_type) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | unless defined $is_qname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 88 | ▶ | if($is_qname) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | { # rewrite prefixed values into "{ns}local" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 10 | ▶ | my ($prefix, $local) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | = $value =~ m/\:/ ? split(/\:/, $value, 2) : ('', $value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 10 | my $ns = $child->lookupNamespaceURI($prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 10 | $value = pack_type $ns, $local; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 10 | $self->_registerNSprefix($prefix, $ns, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 88 | push @{$facets{enumeration}}, $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 30 | elsif($facet eq 'pattern') { push @{$facets{pattern}}, $value } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 154 | elsif(!exists $facets{$facet}) { $facets{$facet} = $value } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | { error __x"facet `{facet}' defined twice at {where}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | , facet => $facet, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | return $st | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 287 | ▶ | if $self->{ignore_facets} || !keys %facets; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"ignore_facets"} or not keys %facets
MC/DC50%1/2
$self->{"ignore_facets"} or not keys %facets
$self->{"ignore_facets"}
not keys %facets
Truth table66%2/3
A or not(B)
A= $self->{"ignore_facets"}B= not keys %facets
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 210 | my %facets_info = %facets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | # new facets overrule all of the base-class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 210 | ▶ | if(defined $facets{totalDigits} && defined $facets{fractionDigits}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $facets{"totalDigits"} and defined $facets{"fractionDigits"}
MC/DC100%2/2
defined $facets{"totalDigits"} and defined $facets{"fractionDigits"}
defined $facets{"totalDigits"}
defined $facets{"fractionDigits"}
Truth table100%3/3
A and B
A= defined $facets{"totalDigits"}B= defined $facets{"fractionDigits"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 3 | { my $td = delete $facets{totalDigits}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 3 | my $fd = delete $facets{fractionDigits}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 3 | $facets{_totalFracDigits} = [$td, $fd]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 210 | my (@early, @late); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 210 | ▶ | my $action = $self->actsAs('WRITER') ? 'WRITER' : 'READER'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 210 | foreach my $facet (keys %facets) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | { my $h = builtin_facet($where, $self, $facet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 243 | ▶ | , $facets{$facet}, $is_list, $type, $nss, $action) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 241 | ▶ | if($facets_early{$facet}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 34 | { push @early, $h } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 207 | else { push @late, $h } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | $is_list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 210 | ▶ | ? $self->makeFacetsList($where, $st, \%facets_info, \@early, \@late) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | : $self->makeFacets($where, $st, \%facets_info, \@early, \@late); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | sub element($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 1914 | ▶ | { my ($self, $tree, $is_root) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
element: called CC=59 SCAR=41.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | # attributes: abstract, default, fixed, form, id, maxOccurs, minOccurs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | # , name, nillable, ref, substitutionGroup, targetNamespace, type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | # ignored: block, final, targetNamespace additional restrictions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | # content: annotation? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | # , (simpleType | complexType)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | # , (unique | key | keyref)* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 1914 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 1914 | my $parent = $node->parentNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 1914 | ▶ | my $is_global= $parent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$parent && $parent->isa('XML::LibXML::Element') && $parent->localname eq 'schema'
$parent and $parent->isa("XML::LibXML::Element")
MC/DC66%2/3
$parent && $parent->isa('XML::LibXML::Element') && $parent->localname eq 'schema'
$parent
$parent->isa("XML::LibXML::Element")
$parent->localname eq 'schema'
Truth table75%3/4
A and B && C
A= $parentB= $parent->isa("XML::LibXML::Element")C= $parent->localname eq 'schema'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | && $parent->isa('XML::LibXML::Element') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | && $parent->localname eq 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 1914 | my $where = $tree->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 1914 | ▶ | my $name = $node->getAttribute('name') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | or error __x"element has no name nor ref at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 1914 | $self->assertType($where, name => NCName => $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | # Full name based on current context. This might be a global name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | # or a local name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 1914 | my $context = $self->{_context}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | # Determine the context of this element. When it is a global, we need | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | # to set-up a new context until end-of-function. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 1914 | my $abstract = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 1914 | my ($qual, $ns, $fullname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 1914 | ▶ | if($is_global) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 876 | ▶ | { $ns = $node->getAttribute('targetNamespace') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$node->getAttribute('targetNamespace') || $parent->getAttribute('targetNamespace')
MC/DC50%1/2
$node->getAttribute('targetNamespace') || $parent->getAttribute('targetNamespace')
$node->getAttribute('targetNamespace')
$parent->getAttribute('targetNamespace')
Truth table66%2/3
A || B
A= $node->getAttribute('targetNamespace')B= $parent->getAttribute('targetNamespace')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | || $parent->getAttribute('targetNamespace'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 876 | $fullname= pack_type $ns, $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 876 | my $def = $self->namespaces->find(element => $fullname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 876 | $context = $self->nsContext($def); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 876 | $qual = $context->{qual_top}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | # abstract elements are not to be used in messages. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 876 | ▶ | $abstract = $self->{abstract_types} eq 'ACCEPT' ? 0 : $def->{abstract}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 1038 | { $qual = $context->{qual_elem}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 1038 | ▶ | $ns = $node->getAttribute('targetNamespace') || $context->{tns}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$node->getAttribute('targetNamespace') || $context->{'tns'}
MC/DC50%1/2
$node->getAttribute('targetNamespace') || $context->{'tns'}
$node->getAttribute('targetNamespace')
$context->{'tns'}
Truth table66%2/3
A || B
A= $node->getAttribute('targetNamespace')B= $context->{'tns'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 1038 | $fullname = pack_type $ns, $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 1914 | ▶ | if(my $form = $node->getAttribute('form')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 8 | ▶ | { $qual | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | = $form eq 'qualified' ? 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | : $form eq 'unqualified' ? 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | : error __x"form must be (un)qualified, not `{form}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | , form => $form, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 1914 | ▶ | local $self->{_context} = $context if $is_global; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 1914 | ▶ | my $nodetype = $qual ? $fullname : $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | # SubstitionGroups | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | # We know the type of the message root, so do not need to look for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | # alternative sgs (and it wouldn't work anyway) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 1914 | my @sgs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 1914 | ▶ | @sgs = $self->namespaces->findSgMembers($node->localName, $fullname) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | unless $is_root; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | # Handle re-usable fragments, fight against combinatorial explosions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 1914 | my $nodeid = $node->unique_key; #$node->nodePath.'#'.$fullname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 1914 | ▶ | if(my $already = $self->{_created}{$nodeid}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | { # We cannot cache compile subst-group handlers, because sgs using | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | # elements which were already compiled into sgs does not work. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 14 | ▶ | $already = $self->substitutionGroup($tree, $fullname, $nodetype | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | , $already, \@sgs) if @sgs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 14 | return ($nodetype, $already); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | # Detect recursion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | # Very complicated: recursively nested structures. It is less of a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | # problem when you handle in run-time what you see... but we here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | # have to be prepared for everything. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 1900 | ▶ | if(exists $self->{_nest}{$nodeid}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 12 | { my $outer = \$self->{_nest}{$nodeid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 12 | ▶ | my $nested = sub { $$outer->(@_) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | # The code must be blessed in the right class, to be compiled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | # correctly inside its parent. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 12 | ▶ | bless $nested, 'BLOCK' if @sgs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 12 | return ($nodetype, $nested); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 1888 | $self->{_nest}{$nodeid} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | # Construct XML tag to use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 1888 | ▶ | my $trans = $qual ? 'makeTagQualified' : 'makeTagUnqualified'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 1888 | my $tag = $self->$trans($where, $node, $name, $ns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | # Construct type processor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 1888 | my ($comptype, $comps); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 1888 | my $nr_childs = $tree->nrChildren; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 1888 | ▶ | if(my $isa = $node->getAttribute('type')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | { # explicitly names type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 1369 | ▶ | $nr_childs==0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | or error __x"no childs expected with attribute `type' at {where}", where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 1369 | $comptype = $self->rel2abs($where, $node, $isa); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 1369 | ▶ | $comps = $self->blocked($where, anyType => $comptype) || $self->typeByName($where, $tree, $comptype); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->blocked($where, 'anyType', $comptype) || $self->typeByName($where, $tree, $comptype)
MC/DC0%0/2
$self->blocked($where, 'anyType', $comptype) || $self->typeByName($where, $tree, $comptype)
$self->blocked($where, 'anyType', $comptype)
$self->typeByName($where, $tree, $comptype)
Truth table66%2/3
A || B
A= $self->blocked($where, 'anyType', $comptype)B= $self->typeByName($where, $tree, $comptype)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | elsif($nr_childs==0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | { # default type for substGroups is type of base-class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 17 | my $base_node = $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 17 | local $self->{_context}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 17 | ▶ | while(my $subst = $base_node->getAttribute('substitutionGroup')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 5 | { my $subst_elem = $self->rel2abs($where, $base_node, $subst); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 5 | my $base_elem = $self->namespaces->find(element => $subst_elem); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 5 | $self->{_context} = $self->nsContext($base_elem); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 5 | $base_node = $base_elem->{node}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 5 | ▶ | my $isa = $base_node->getAttribute('type') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 5 | $comptype = $self->rel2abs($where, $base_node, $isa); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 5 | ▶ | $comps = $self->blocked($where, complexType => $comptype) || $self->typeByName($where, $tree, $comptype); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->blocked($where, 'complexType', $comptype) || $self->typeByName($where, $tree, $comptype)
MC/DC0%0/2
$self->blocked($where, 'complexType', $comptype) || $self->typeByName($where, $tree, $comptype)
$self->blocked($where, 'complexType', $comptype)
$self->typeByName($where, $tree, $comptype)
Truth table33%1/3
A || B
A= $self->blocked($where, 'complexType', $comptype)B= $self->typeByName($where, $tree, $comptype)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 5 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 17 | ▶ | unless($comptype) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | { # no type found, so anyType | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 12 | $comptype = $self->anyType($node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 12 | $comps = $self->typeByName($where, $tree, $comptype); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | elsif($nr_childs!=1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | { error __x"expected is only one child node at {where}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | else # nameless types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 502 | { my $child = $tree->firstChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 502 | my $local = $child->localname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 502 | my $nest = $tree->descend($child); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | # Sometimes extension or restriction with base attribute required for hooks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 502 | my $ext = $nest->firstChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 502 | ▶ | my $base = $ext ? $ext->getAttribute('base') : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 502 | ▶ | my $basex = $base ? $self->rel2abs($where, $ext, $base) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 502 | ▶ | ($comps, $comptype) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition75%3/4
$basex // "unnamed simple"
$basex // "unnamed complex"
MC/DC100%1/1
$basex // "unnamed simple"
$basex
MC/DC0%0/1
$basex // "unnamed complex"
$basex
Truth table100%2/2
A
A= $basex
Truth table50%1/2
A
A= $basex
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | = $local eq 'simpleType' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | ? ($self->simpleType($nest, 0), $basex // 'unnamed simple') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | : $local eq 'complexType' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | ? ($self->complexType($nest), $basex // 'unnamed complex') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | : error __x"illegal element child `{name}' at {where}", name => $local, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | my ($st, $elems, $attrs, $attrs_any) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 1886 | = @$comps{ qw/st elems attrs attrs_any/ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 1886 | ▶ | $_ ||= [] for $elems, $attrs, $attrs_any; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_ ||= []
MC/DC100%1/1
$_ ||= []
$_
Truth table100%2/2
A
A= $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | # Construct basic element handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 1886 | my $is_simple = defined $st; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 1886 | ▶ | my $nillable = $self->isTrue($node->getAttribute('nillable') || 'false'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$node->getAttribute('nillable') || 'false'
MC/DC100%1/1
$node->getAttribute('nillable') || 'false'
$node->getAttribute('nillable')
Truth table100%2/2
A
A= $node->getAttribute('nillable')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | my $elem_handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 1886 | ▶ | = $comps->{mixed} ? 'makeMixedElement' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
@$attrs or @$attrs_any
MC/DC50%1/2
@$attrs or @$attrs_any
@$attrs
@$attrs_any
Truth table66%2/3
A or B
A= @$attrsB= @$attrs_any
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | : ! $is_simple ? 'makeComplexElement' # other complexType | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | : (@$attrs || @$attrs_any) ? 'makeTaggedElement' # complex/simpleContent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | : 'makeSimpleElement'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 1886 | ▶ | my $r = $self->$elem_handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$st || $elems
MC/DC0%0/2
$st || $elems
$st
$elems
Truth table66%2/3
A || B
A= $stB= $elems
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | ( $where, $tag, ($st||$elems), $attrs, $attrs_any, $comptype, $nillable); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | # Add defaults and stuff | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 1886 | my $default = $node->getAttributeNode('default'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 1886 | my $fixed = $node->getAttributeNode('fixed'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 1886 | ▶ | $default && $fixed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$default and $fixed
MC/DC0%0/2
$default and $fixed
$default
$fixed
Truth table66%2/3
A and B
A= $defaultB= $fixed
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | and error __x"element can not have default and fixed at {where}", where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 1886 | ▶ | my $value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | = $default ? $default->textContent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | : $fixed ? $fixed->textContent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 1886 | ▶ | my $generate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | = $abstract ? 'makeElementAbstract' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | : $default ? 'makeElementDefault' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | : $fixed ? 'makeElementFixed' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | : 'makeElement'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 1886 | my $do = $self->$generate($where, $ns, $nodetype, $r, $value, $tag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | # hrefs are used by SOAP-RPC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | $do = $self->makeElementHref($where, $ns, $nodetype, $do) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 1886 | ▶ | if $self->{permit_href} && $self->actsAs('READER'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"permit_href"} and $self->actsAs("READER")
MC/DC0%0/2
$self->{"permit_href"} and $self->actsAs("READER")
$self->{"permit_href"}
$self->actsAs("READER")
Truth table33%1/3
A and B
A= $self->{"permit_href"}B= $self->actsAs("READER")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | # Implement hooks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 1886 | my ($before, $replace, $after) = $self->findHooks($where, $comptype, $node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 1886 | ▶ | $do = $self->makeHook($where, $do, $tag, $before, $replace, $after, $comptype) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$before or $replace or $after
$before or $replace
MC/DC100%3/3
$before or $replace or $after
$before
$replace
$after
Truth table100%4/4
A or B or C
A= $beforeB= $replaceC= $after
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | if $before || $replace || $after; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | $do = $self->xsiType($tree, $node, $name, $comptype, $do) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 1886 | ▶ | if $comptype && $self->{xsi_type}{$comptype}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$comptype and $self->{"xsi_type"}{$comptype}
MC/DC50%1/2
$comptype and $self->{"xsi_type"}{$comptype}
$comptype
$self->{"xsi_type"}{$comptype}
Truth table66%2/3
A and B
A= $comptypeB= $self->{"xsi_type"}{$comptype}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | $do = $self->addTypeAttribute($comptype, $do) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 1886 | ▶ | if $self->{xsi_type_everywhere} && $comptype !~ /^unnamed /; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"xsi_type_everywhere"} and not $comptype =~ /^unnamed /
MC/DC100%2/2
$self->{"xsi_type_everywhere"} and not $comptype =~ /^unnamed /
$self->{"xsi_type_everywhere"}
not $comptype =~ /^unnamed /
Truth table100%3/3
A and not(B)
A= $self->{"xsi_type_everywhere"}B= not $comptype =~ /^unnamed /
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 1886 | $self->{_created}{$nodeid} = $do; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 1886 | ▶ | $do = $self->substitutionGroup($tree, $fullname, $nodetype, $do, \@sgs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | if @sgs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | # handle recursion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | # this must look very silly to you... however, this is resolving | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | # recursive schemas: this way nested use of the same element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | # definition will catch the code reference of the outer definition. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 1886 | $self->{_nest}{$nodeid} = $do; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 1886 | delete $self->{_nest}{$nodeid}; # clean the outer definition | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 1886 | ($nodetype, $do); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | sub particle($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 1732 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
particle: called CC=23 SCAR=31.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 1732 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 1732 | my $local = $node->localName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 1732 | my $where = $tree->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 1732 | my $min = $node->getAttribute('minOccurs'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 1732 | my $max = $node->getAttribute('maxOccurs'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 1732 | ▶ | unless(defined $min) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 1470 | ▶ | { $min = ($self->actsAs('WRITER') || $self->{default_values} ne 'EXTEND') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
$self->actsAs("WRITER") || $self->{"default_values"} ne "EXTEND" and $node->getAttribute("default") || $node->getAttribute("fixed")
$self->actsAs("WRITER") or $self->{"default_values"} ne "EXTEND"
$node->getAttribute("default") or $node->getAttribute("fixed")
MC/DC100%4/4
$self->actsAs("WRITER") || $self->{"default_values"} ne "EXTEND" and $node->getAttribute("default") || $node->getAttribute("fixed")
$self->actsAs("WRITER")
$self->{"default_values"} ne "EXTEND"
$node->getAttribute("default")
$node->getAttribute("fixed")
Truth table85%6/7
A or B and C or D
A= $self->actsAs("WRITER")B= $self->{"default_values"} ne "EXTEND"C= $node->getAttribute("default")D= $node->getAttribute("fixed")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | && ($node->getAttribute('default') || $node->getAttribute('fixed')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | $min = 0 if $self->{interpret_nillable_as_optional} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 1732 | ▶ | && $self->isTrue($node->getAttribute('nillable') || 'false'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
$self->{"interpret_nillable_as_optional"} and $self->isTrue($node->getAttribute("nillable") || "false")
$node->getAttribute('nillable') || 'false'
MC/DC100%2/2
$self->{"interpret_nillable_as_optional"} and $self->isTrue($node->getAttribute("nillable") || "false")
$self->{"interpret_nillable_as_optional"}
$self->isTrue($node->getAttribute("nillable") || "false")
MC/DC100%1/1
$node->getAttribute('nillable') || 'false'
$node->getAttribute('nillable')
Truth table100%3/3
A and B
A= $self->{"interpret_nillable_as_optional"}B= $self->isTrue($node->getAttribute("nillable") || "false")
Truth table100%2/2
A
A= $node->getAttribute('nillable')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | # default attribute in writer means optional, but we want to see | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | # them in the reader, to see the value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 1732 | ▶ | defined $max or $max = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | $max = 'unbounded' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 1732 | ▶ | if $max ne 'unbounded' && $max > 1 && !$self->{check_occurs}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$max ne "unbounded" and $max > 1 and not $self->{"check_occurs"}
$max ne "unbounded" and $max > 1
MC/DC100%3/3
$max ne "unbounded" and $max > 1 and not $self->{"check_occurs"}
$max ne "unbounded"
$max > 1
not $self->{"check_occurs"}
Truth table100%4/4
A and B and not(C)
A= $max ne "unbounded"B= $max > 1C= not $self->{"check_occurs"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | $min = 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 1732 | ▶ | if $max eq 'unbounded' && !$self->{check_occurs}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$max eq "unbounded" and not $self->{"check_occurs"}
MC/DC100%2/2
$max eq "unbounded" and not $self->{"check_occurs"}
$max eq "unbounded"
not $self->{"check_occurs"}
Truth table100%3/3
A and not(B)
A= $max eq "unbounded"B= not $self->{"check_occurs"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 1732 | ▶ | return $self->anyElement($tree, $min, $max) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | if $local eq 'any'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 1722 | ▶ | my ($label, $process) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | = $local eq 'element' ? $self->particleElement($tree) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | : $local eq 'group' ? $self->particleGroup($tree) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | : $local =~ $particle_blocks ? $self->particleBlock($tree) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | : error __x"unknown particle type '{name}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | , name => $local, where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 1722 | ▶ | defined $label | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 1706 | ▶ | if(ref $process eq 'BLOCK') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 627 | { my $key = $self->keyRewrite($label); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 627 | my $multi = $self->blockLabel($local, $key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 627 | return $self->makeBlockHandler($where, $label, $min, $max | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | , $process, $local, $multi); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | # only elements left | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 1079 | my $required; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 1079 | my $key = $self->keyRewrite($label); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 1079 | ▶ | $required = $self->makeRequired($where, $key, $process) if $min!=0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 1079 | ▶ | ($self->actsAs('READER') ? $label : $key) => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | $self->makeElementHandler($where, $key, $min,$max, $required, $process); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | sub particleElement($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 1110 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
particleElement: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 1110 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 1110 | ▶ | if(my $ref = $node->getAttribute('ref')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 79 | { my $where = $tree->path . "/$ref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 79 | my $refname = $self->rel2abs($tree, $node, $ref); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 79 | ▶ | return () if $self->blocked($where, ref => $refname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 67 | ▶ | my $def = $self->namespaces->find(element => $refname) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | or error __x"cannot find ref element '{name}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | , name => $refname, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | return $self->element($tree->descend($def->{node} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 67 | , $self->prefixed($refname, 1))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 1031 | my $name = $node->getAttribute('name'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 1031 | $self->element($tree->descend($node, $name)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | # blockLabel KIND, LABEL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | # Particle blocks, like `sequence' and `choice', which have a maxOccurs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | # (maximum occurrence) which is 2 of more, are represented by an ARRAY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | # of HASHs. The label with such a block is derived from its first element. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | # This function determines how. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | # seq_address sequence get seq_ prepended | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | # cho_gender choices get cho_ before them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | # all_money an all block can also be repreated in spec >1.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | # gr_people group refers to a block of above type, but | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | # that type is not reflected in the name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 50 | my %block_abbrev = qw/sequence seq_ choice cho_ all all_ group gr_/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | sub blockLabel($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 627 | ▶ | { my ($self, $kind, $label) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
blockLabel: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 627 | ▶ | return $label if $kind eq 'element'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 608 | $label =~ s/^(?:seq|cho|all|gr)_//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 608 | $block_abbrev{$kind} . (unpack_type $label)[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | sub particleGroup($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 20 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
particleGroup: called CC=8 SCAR=21.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | # attributes: id, maxOccurs, minOccurs, name, ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | # content: annotation?, (all|choice|sequence)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | # apparently, a group can not refer to a group... well.. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 20 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 20 | ▶ | my $ref = $node->getAttribute('ref') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | or error __x"group without ref at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | , where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 20 | my $where = $tree->path . '#' . $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 20 | my $typename = $self->rel2abs($where, $node, $ref); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 20 | ▶ | if(my $blocked = $self->blocked($where, ref => $typename)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | { return ($typename, $blocked); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 20 | ▶ | my $dest = $self->namespaces->find(group => $typename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | or error __x"cannot find group `{name}' at {where}", name => $typename, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 20 | my $group = $tree->descend($dest->{node}, $self->prefixed($typename, 1)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 20 | ▶ | return () if $group->nrChildren==0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 20 | ▶ | $group->nrChildren==1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | or error __x"only one particle block expected in group `{name}' at {where}", name => $typename, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 20 | my $local = $group->currentLocal; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 20 | ▶ | $local =~ m/^(?:all|choice|sequence)$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | or error __x"illegal group member `{name}' at {where}", name => $local, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 20 | my ($blocklabel, $code) = $self->particleBlock($group->descend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 20 | ▶ | $code ? ($typename, $code) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | sub particleBlock($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 612 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
particleBlock: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 612 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 612 | my @pairs = map $self->particle($tree->descend($_)), $tree->childs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 612 | ▶ | @pairs or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | # label is name of first component, only needed when maxOcc > 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 608 | my $label = $pairs[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 608 | my $blocktype = $node->localName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 608 | my $call = 'make'.ucfirst $blocktype; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 608 | ($label => $self->$call($tree->path, @pairs)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | sub xsiType($$$$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 7 | ▶ | { my ($self, $tree, $node, $name, $type, $base) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xsiType: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 7 | my %alt = ($type => $base); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 7 | foreach my $alttype (@{$self->{xsi_type}{$type}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 11 | ▶ | { next if $alttype eq $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 7 | my ($ns, $local) = unpack_type $alttype; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 7 | my $prefix = $node->lookupNamespacePrefix($ns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 7 | ▶ | defined $prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | or $prefix = $self->_registerNSprefix(undef, $ns, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 7 | ▶ | my $type = length $prefix ? "$prefix:$local" : $local; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | # do not accidentally use the default namespace, when there | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | # may also be namespace-less types used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 7 | my $doc = $node->ownerDocument; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 7 | my $altnode = $doc->createElement('element'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 7 | $altnode->setNamespace(SCHEMA2001, 'temp1234', 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 7 | $altnode->setNamespace($ns, $prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 7 | $altnode->setAttribute(name => $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 7 | $altnode->setAttribute(type => $type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 7 | delete $self->{_created}{$altnode->unique_key}; # clean nesting cache | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 7 | (undef, $alt{$alttype}) = $self->element($tree->descend($altnode)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 7 | $self->makeXsiTypeSwitch($tree->path, $name, $type, \%alt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | sub substitutionGroup($$$$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 21 | ▶ | { my ($self, $tree, $fullname, $label, $base, $sgs) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
substitutionGroup: called CC=5 SCAR=19.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 21 | ▶ | if(Log::Report->needs('TRACE')) # dump table of substgroup alternatives | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | { my $labelrw = $self->keyRewrite($label); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | my @full = sort map $_->{full}, @$sgs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | my $longest = max map length, @full; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | my @c = map sprintf("%-${longest}s %s",$_,$self->keyRewrite($_)), @full; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | local $" = "\n "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | trace "substitutionGroup $fullname$\"BASE=$label ($labelrw)$\"@c"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 21 | my @elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 21 | ▶ | push @elems, $label => [$self->keyRewrite($label), $base] if $base; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 21 | foreach my $subst (@$sgs) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 40 | { my ($l, $d) = $self->element($tree->descend($subst->{node}), 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 40 | ▶ | push @elems, $l => [$self->keyRewrite($l), $d] if defined $d; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 21 | $self->makeSubstgroup($tree->path.'#subst', $fullname, @elems); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | sub keyRewrite($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 2111 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
keyRewrite: called CC=16 SCAR=31.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 2111 | ▶ | my ($ns, $key) = @_==1 ? unpack_type($_[0]) : @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 2111 | my $oldkey = $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 2111 | foreach my $r ( @{$self->{rewrite}} ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 115 | ▶ | { if(ref $r eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 14 | { my $full = pack_type $ns, $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 14 | ▶ | $key = $r->{$full} if defined $r->{$full}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 14 | ▶ | $key = $r->{$key} if defined $r->{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | elsif(ref $r eq 'CODE') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 51 | { $key = $r->($ns, $key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | elsif($r eq 'UNDERSCORES') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | { $key =~ s/-/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | elsif($r eq 'SIMPLIFIED') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 21 | { $key =~ s/-/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 21 | $key =~ s/\W//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 21 | $key = lc $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | elsif($r eq 'PREFIXED') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 29 | { my $p = $self->{prefixes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 29 | ▶ | my $prefix = $p->{$ns} ? $p->{$ns}{prefix} : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 29 | ▶ | $key = $prefix . '_' . $key if $prefix ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | elsif($r =~ m/^PREFIXED\(\s*(.*?)\s*\)$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | { my @l = split /\s*\,\s*/, $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | my $p = $self->{prefixes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | ▶ | my $prefix = $p->{$ns} ? $p->{$ns}{prefix} : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 0 | ▶ | $key = $prefix . '_' . $key if grep {$prefix eq $_} @l; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | { error __x"key rewrite `{got}' not understood", got => $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 2111 | ▶ | trace "rewrote type @_ to $key" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | if $key ne $oldkey; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 2111 | $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | sub prefixed($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 1004 | ▶ | { my ($self, $qname, $hide_use) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prefixed: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | # hide_use = do not cause inclusion in output prefix table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 1004 | my ($ns, $local) = unpack_type $qname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 1004 | ▶ | defined $ns or return $qname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 1004 | ▶ | my $pn = $self->{prefixes}{$ns} or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 269 | ▶ | $pn->{used}++ unless $hide_use; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 269 | ▶ | length $pn->{prefix} ? "$pn->{prefix}:$local" : $local; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | sub prefixForNamespace($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 0 | ▶ | { my ($self, $ns) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prefixForNamespace: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | ▶ | my $def = $self->{prefixes}{$ns} or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 0 | $def->{prefix}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | sub attribute($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 261 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attribute: called CC=29 SCAR=34.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | # attributes: default, fixed, form, id, name, ref, type, use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | # content: annotation?, simpleType? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 261 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 261 | my $parent = $node->parentNode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 261 | ▶ | my $is_global= $parent && $parent->localname eq 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$parent && $parent->localname eq 'schema'
MC/DC50%1/2
$parent && $parent->localname eq 'schema'
$parent
$parent->localname eq 'schema'
Truth table66%2/3
A && B
A= $parentB= $parent->localname eq 'schema'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 261 | my $where = $tree->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 261 | my $context = $self->{_context}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 261 | ▶ | if(my $refattr = $node->getAttribute('ref')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 5 | my $refname = $self->rel2abs($tree, $node, $refattr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 5 | ▶ | return () if $self->blocked($where, ref => $refname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 5 | ▶ | my $def = $self->namespaces->find(attribute => $refname) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | or error __x"cannot find attribute {name} at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | , name => $refname, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 5 | local $self->{_context} = $def; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 5 | return $self->attribute($tree->descend($def->{node})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | # Not a ref to attribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 256 | ▶ | my $name = $node->getAttribute('name') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | or error __x"attribute without name at {where}", where => $where; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 256 | $where .= '/@'.$name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 256 | $self->assertType($where, name => NCName => $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 256 | my ($qual, $ns, $fullname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 256 | ▶ | if($is_global) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 13 | ▶ | { $ns = $node->getAttribute('targetNamespace') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$node->getAttribute('targetNamespace') || $parent->getAttribute('targetNamespace')
MC/DC0%0/2
$node->getAttribute('targetNamespace') || $parent->getAttribute('targetNamespace')
$node->getAttribute('targetNamespace')
$parent->getAttribute('targetNamespace')
Truth table33%1/3
A || B
A= $node->getAttribute('targetNamespace')B= $parent->getAttribute('targetNamespace')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | || $parent->getAttribute('targetNamespace'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 13 | $fullname= pack_type $ns, $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 13 | my $def = $self->namespaces->find(attribute => $fullname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 13 | $context = $self->nsContext($def); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 13 | $qual = $context->{qual_top}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 243 | { $qual = $context->{qual_attr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 243 | $ns = $context->{tns}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 243 | $fullname= pack_type $ns, $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 256 | ▶ | local $self->{_context} = $context if $is_global; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 256 | ▶ | if(my $form = $node->getAttribute('form')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | ▶ | { $qual | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | = $form eq 'qualified' ? 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | : $form eq 'unqualified' ? 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | : error __x"form must be (un)qualified, not `{form}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | , form => $form, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | # no default prefixes for attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | #warn "#", $self->prefixForNamespace($ns), "#"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | # error __x"attribute namespace {ns} cannot be the default namespace" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | # , ns => $ns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | # if $qual && $ns && $self->prefixForNamespace($ns) eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 256 | my ($type, $typeattr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 256 | ▶ | if($tree->nrChildren==1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 7 | ▶ | { $tree->currentLocal eq 'simpleType' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | or error __x"attribute child can only be `simpleType', not `{found}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | , found => $tree->currentLocal, where => $where | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | , _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 7 | $type = $self->simpleType($tree->descend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 249 | ▶ | { $name = $node->getAttribute('name') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | or error __x"attribute without name or ref at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 249 | $typeattr = $node->getAttribute('type'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 256 | ▶ | unless($type) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 249 | ▶ | { my $typename = defined $typeattr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | ? $self->rel2abs($where, $node, $typeattr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | : $self->anyType($node); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 249 | ▶ | $type = $self->blocked($where, simpleType => $typename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->blocked($where, 'simpleType', $typename) || $self->typeByName($where, $tree, $typename)
MC/DC0%0/2
$self->blocked($where, 'simpleType', $typename) || $self->typeByName($where, $tree, $typename)
$self->blocked($where, 'simpleType', $typename)
$self->typeByName($where, $tree, $typename)
Truth table66%2/3
A || B
A= $self->blocked($where, 'simpleType', $typename)B= $self->typeByName($where, $tree, $typename)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | || $self->typeByName($where, $tree, $typename); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | my $st = $type->{st} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 256 | ▶ | or error __x"attribute not based in simple value type at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 256 | ▶ | my $trans = $qual ? 'makeTagQualified' : 'makeTagUnqualified'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 256 | ▶ | my $qns = $qual ? $context->{tns} : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 256 | my $tag = $self->$trans($where, $node, $name, $qns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 256 | ▶ | my $use = $node->getAttribute('use') || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$node->getAttribute('use') || ''
MC/DC100%1/1
$node->getAttribute('use') || ''
$node->getAttribute('use')
Truth table100%2/2
A
A= $node->getAttribute('use')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 256 | ▶ | $use =~ m/^(?:optional|required|prohibited|)$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | or error __x"attribute use is required, optional or prohibited (not '{use}') at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | , use => $use, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 256 | my $default = $node->getAttributeNode('default'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 256 | my $fixed = $node->getAttributeNode('fixed'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 256 | ▶ | my $generate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | = defined $default ? 'makeAttributeDefault' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | : defined $fixed ? 'makeAttributeFixed' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | : $use eq 'required' ? 'makeAttributeRequired' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | : $use eq 'prohibited'? 'makeAttributeProhibited' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | : 'makeAttribute'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 256 | ▶ | my $value = defined $default ? $default : $fixed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 256 | my $label = $self->keyRewrite($qns, $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 256 | my $do = $self->$generate($where, $qns, $tag, $label, $st, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | 256 | ▶ | defined $do ? ($label => $do) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | sub attributeGroup($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 6 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attributeGroup: called CC=4 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | # attributes: id, ref = QName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | # content: annotation? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 6 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 6 | my $where = $tree->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 6 | ▶ | my $ref = $node->getAttribute('ref') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | or error __x"attributeGroup use without ref at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | , where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 6 | my $typename = $self->rel2abs($where, $node, $ref); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 6 | ▶ | return () if $self->blocked($where, ref => $typename); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 6 | ▶ | my $def = $self->namespaces->find(attributeGroup => $typename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | or error __x"cannot find attributeGroup {name} at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | , name => $typename, where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 6 | local $self->{tns} = $def->{ns}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 6 | $self->attributeList($tree->descend($def->{node})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | # Don't known how to handle notQName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | sub anyAttribute($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 10 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
anyAttribute: called CC=6 SCAR=18.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | # attributes: id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | # , namespace = ##any|##other| List of (anyURI|##targetNamespace|##local) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | # , notNamespace = List of (anyURI|##targetNamespace|##local) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | # ignored attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | # , notQName = List of QName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | # , processContents = lax|skip|strict | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | # content: annotation? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 10 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | 10 | my $where = $tree->path . '@any'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 10 | my $handler = $self->{any_attribute}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 10 | ▶ | my $namespace = $node->getAttribute('namespace') || '##any'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->getAttribute('namespace') || '##any'
MC/DC0%0/1
$node->getAttribute('namespace') || '##any'
$node->getAttribute('namespace')
Truth table50%1/2
A
A= $node->getAttribute('namespace')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 10 | my $not_ns = $node->getAttribute('notNamespace'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 10 | ▶ | my $process = $node->getAttribute('processContents') || 'strict'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->getAttribute('processContents') || 'strict'
MC/DC0%0/1
$node->getAttribute('processContents') || 'strict'
$node->getAttribute('processContents')
Truth table50%1/2
A
A= $node->getAttribute('processContents')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 10 | ▶ | warn "HELP: please explain me how to handle notQName" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$^W and $node->getAttribute("notQName")
MC/DC0%0/2
$^W and $node->getAttribute("notQName")
$^W
$node->getAttribute("notQName")
Truth table33%1/3
A and B
A= $^WB= $node->getAttribute("notQName")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | if $^W && $node->getAttribute('notQName'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 10 | my ($yes, $no) = $self->translateNsLimits($namespace, $not_ns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 10 | my $do = $self->makeAnyAttribute($where, $handler, $yes, $no, $process); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 10 | ▶ | defined $do ? $do : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | sub anyElement($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 10 | ▶ | { my ($self, $tree, $min, $max) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
anyElement: called CC=5 SCAR=17.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | # attributes: id, maxOccurs, minOccurs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | # , namespace = ##any|##other| List of (anyURI|##targetNamespace|##local) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | # , notNamespace = List of (anyURI|##targetNamespace|##local) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | # ignored attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | # , notQName = List of QName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | # , processContents = lax|skip|strict | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | # content: annotation? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 10 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | 10 | my $where = $tree->path . '#any'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 10 | my $handler = $self->{any_element}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 10 | ▶ | my $namespace = $node->getAttribute('namespace') || '##any'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->getAttribute('namespace') || '##any'
MC/DC0%0/1
$node->getAttribute('namespace') || '##any'
$node->getAttribute('namespace')
Truth table50%1/2
A
A= $node->getAttribute('namespace')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 10 | my $not_ns = $node->getAttribute('notNamespace'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 10 | ▶ | my $process = $node->getAttribute('processContents') || 'strict'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->getAttribute('processContents') || 'strict'
MC/DC0%0/1
$node->getAttribute('processContents') || 'strict'
$node->getAttribute('processContents')
Truth table50%1/2
A
A= $node->getAttribute('processContents')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 10 | ▶ | info "HELP: please explain me how to handle notQName" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$^W and $node->getAttribute("notQName")
MC/DC0%0/2
$^W and $node->getAttribute("notQName")
$^W
$node->getAttribute("notQName")
Truth table33%1/3
A and B
A= $^WB= $node->getAttribute("notQName")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | if $^W && $node->getAttribute('notQName'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | 10 | my ($yes, $no) = $self->translateNsLimits($namespace, $not_ns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | 10 | (any => $self->makeAnyElement($where, $handler, $yes, $no | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | , $process, $min, $max)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | sub translateNsLimits($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 20 | ▶ | { my ($self, $include, $exclude) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
translateNsLimits: called CC=10 SCAR=23.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | # namespace = ##any|##other| List of (anyURI|##targetNamespace|##local) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | # notNamespace = List of (anyURI |##targetNamespace|##local) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | # handling of ##local ignored: only full namespaces are supported for now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 20 | ▶ | return (undef, []) if $include eq '##any'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 12 | my $tns = $self->{_context}{tns}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 12 | ▶ | return (undef, [$tns]) if $include eq '##other'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 8 | my @return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | 8 | foreach my $list ($include, $exclude) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 16 | { my @list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 16 | ▶ | if(defined $list && length $list) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $list and length $list
MC/DC50%1/2
defined $list and length $list
defined $list
length $list
Truth table66%2/3
A and B
A= defined $listB= length $list
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 8 | { foreach my $uri (split " ", $list) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | 8 | ▶ | { push @list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | , $uri eq '##targetNamespace' ? $tns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | : $uri eq '##local' ? () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | : $uri; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 16 | ▶ | push @return, @list ? \@list : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 8 | @return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | sub complexType($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | 606 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
complexType: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | # abstract, block, final, id, mixed, name, defaultAttributesApply | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | # Full content: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | # annotation? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | # , ( simpleContent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | # | complexContent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | # | ( (group|all|choice|sequence)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | # , (attribute|attributeGroup)* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | # , anyAttribute? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | # ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | # ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | # , (assert | report)* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 606 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | 606 | ▶ | my $mixed = $self->isTrue($node->getAttribute('mixed') || 'false'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$node->getAttribute('mixed') || 'false'
MC/DC100%1/1
$node->getAttribute('mixed') || 'false'
$node->getAttribute('mixed')
Truth table100%2/2
A
A= $node->getAttribute('mixed')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | undef $mixed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 606 | ▶ | if $self->{mixed_elements} eq 'STRUCTURAL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 606 | ▶ | my $first = $tree->firstChild | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | or return {elems => [], mixed => $mixed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 582 | my $name = $first->localName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 582 | ▶ | return $self->complexBody($tree, $mixed) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$name =~ /$particle_blocks/ or $name =~ /$attribute_defs/
MC/DC100%2/2
$name =~ /$particle_blocks/ or $name =~ /$attribute_defs/
$name =~ /$particle_blocks/
$name =~ /$attribute_defs/
Truth table100%3/3
A or B
A= $name =~ /$particle_blocks/B= $name =~ /$attribute_defs/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | if $name =~ $particle_blocks || $name =~ $attribute_defs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 56 | ▶ | $tree->nrChildren==1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | or error __x"expected is single simpleContent or complexContent at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | , where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 56 | ▶ | return $self->simpleContent($tree->descend($first)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | if $name eq 'simpleContent'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 34 | ▶ | return $self->complexContent($tree->descend($first), $mixed) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | if $name eq 'complexContent'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 1 | error __x"complexType contains particles, simpleContent or complexContent, not `{name}' at {where}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | , name => $name, where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | sub complexBody($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | 558 | ▶ | { my ($self, $tree, $mixed) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
complexBody: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 558 | ▶ | $tree->currentChild | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | # partial | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | # (group|all|choice|sequence)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | # , ((attribute|attributeGroup)* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | # , anyAttribute? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 558 | my @elems; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | 558 | ▶ | if($tree->currentLocal =~ $particle_blocks) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 526 | { push @elems, $self->particle($tree->descend); # unless $mixed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | 526 | $tree->nextChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | 558 | my @attrs = $self->attributeList($tree); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 558 | ▶ | defined $tree->currentChild | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | and error __x"trailing non-attribute `{name}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | , name => $tree->currentChild->localName, where => $tree->path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | , _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 558 | {elems => \@elems, mixed => $mixed, @attrs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | sub attributeList($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 586 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attributeList: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | # partial content | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | # ((attribute|attributeGroup)* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | # , anyAttribute? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | 586 | my $where = $tree->path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 586 | my (@attrs, @any); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | 586 | ▶ | for(my $attr = $tree->currentChild; defined $attr; $attr = $tree->nextChild) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 264 | { my $name = $attr->localName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 264 | ▶ | if($name eq 'attribute') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | 248 | { push @attrs, $self->attribute($tree->descend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | elsif($name eq 'attributeGroup') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 6 | { my %group = $self->attributeGroup($tree->descend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 6 | push @attrs, @{$group{attrs}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | 6 | push @any, @{$group{attrs_any}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 10 | else { last } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | # officially only one: don't believe that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | 586 | ▶ | while($tree->currentLocal eq 'anyAttribute') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | 10 | { push @any, $self->anyAttribute($tree->descend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 10 | $tree->nextChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | 586 | (attrs => \@attrs, attrs_any => \@any); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | sub simpleContent($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | 22 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
simpleContent: called CC=4 SCAR=14.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | # attributes: id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | # content: annotation?, (restriction | extension) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | 22 | ▶ | $tree->nrChildren==1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | or error __x"need one simpleContent child at {where}", where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | 22 | my $name = $tree->currentLocal; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | 22 | ▶ | return $self->simpleContentExtension($tree->descend) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | if $name eq 'extension'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 8 | ▶ | return $self->simpleContentRestriction($tree->descend) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | if $name eq 'restriction'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | 0 | error __x"simpleContent needs extension or restriction, not `{name}' at {where}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | , name => $name, where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | sub simpleContentExtension($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | 14 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
simpleContentExtension: called CC=5 SCAR=17.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | # attributes: id, base = QName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | # content: annotation? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | # , (attribute | attributeGroup)* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | # , anyAttribute? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | # , (assert | report)* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 14 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | 14 | my $where = $tree->path . '#sext'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 14 | my $base = $node->getAttribute('base'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | 14 | ▶ | my $typename = defined $base ? $self->rel2abs($where, $node, $base) : $self->anyType($node); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 14 | ▶ | my $basetype = $self->blocked($where, simpleType => $typename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->blocked($where, 'simpleType', $typename) || $self->typeByName($where, $tree, $typename)
MC/DC0%0/2
$self->blocked($where, 'simpleType', $typename) || $self->typeByName($where, $tree, $typename)
$self->blocked($where, 'simpleType', $typename)
$self->typeByName($where, $tree, $typename)
Truth table33%1/3
A || B
A= $self->blocked($where, 'simpleType', $typename)B= $self->typeByName($where, $tree, $typename)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | || $self->typeByName($where, $tree, $typename); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | defined $basetype->{st} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | 14 | ▶ | or error __x"base of simpleContent not simple at {where}", where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | 14 | $self->extendAttrs($basetype, {$self->attributeList($tree)}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | 14 | ▶ | $tree->currentChild | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | and error __x"elements left at tail at {where}", where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 14 | $basetype; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | sub simpleContentRestriction($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 8 | ▶ | { my ($self, $tree) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
simpleContentRestriction: called CC=7 SCAR=20.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | # attributes id, base = QName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | # content: annotation? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | # , (simpleType?, facet*)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | # , (attribute | attributeGroup)*, anyAttribute? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | # , (assert | report)* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 8 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 8 | my $where = $tree->path . '#cres'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 8 | my ($type, $typename); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 8 | ▶ | my $first = $tree->currentLocal || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$tree->currentLocal || ''
MC/DC0%0/1
$tree->currentLocal || ''
$tree->currentLocal
Truth table50%1/2
A
A= $tree->currentLocal
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | 8 | ▶ | if($first eq 'simpleType') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | 4 | { $type = $self->simpleType($tree->descend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | 4 | $tree->nextChild; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | elsif(my $basename = $node->getAttribute('base')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 4 | { $typename = $self->rel2abs($where, $node, $basename); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 4 | ▶ | $type = $self->blocked($where, simpleType => $type) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->blocked($where, 'simpleType', $type) || $self->typeByName($where, $tree, $typename)
MC/DC0%0/2
$self->blocked($where, 'simpleType', $type) || $self->typeByName($where, $tree, $typename)
$self->blocked($where, 'simpleType', $type)
$self->typeByName($where, $tree, $typename)
Truth table33%1/3
A || B
A= $self->blocked($where, 'simpleType', $type)B= $self->typeByName($where, $tree, $typename)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | || $self->typeByName($where, $tree, $typename); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | 0 | { error __x"no base in complex-restriction, so simpleType required at {where}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | my $st = $type->{st} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 8 | ▶ | or error __x"not a simpleType in simpleContent/restriction at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | 8 | $type->{st} = $self->applySimpleFacets($tree, $st, 0, $typename); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 8 | $self->extendAttrs($type, {$self->attributeList($tree)}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | 8 | ▶ | $tree->currentChild | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | and error __x"elements left at tail at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | , where => $where, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | 8 | $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | sub complexContent($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 33 | ▶ | { my ($self, $tree, $mixed) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
complexContent: called CC=13 SCAR=27.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | # attributes: id, mixed = boolean | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | # content: annotation?, (restriction | extension) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | 33 | my $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | 33 | ▶ | if(my $m = $node->getAttribute('mixed')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | { $mixed = $self->isTrue($m) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | 0 | ▶ | if $self->{mixed_elements} ne 'STRUCTURAL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | 33 | ▶ | $tree->nrChildren == 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | or error __x"only one complexContent child expected at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | , where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 33 | my $name = $tree->currentLocal; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | 33 | ▶ | error __x"complexContent needs extension or restriction, not `{name}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$name ne "extension" and $name ne "restriction"
MC/DC100%2/2
$name ne "extension" and $name ne "restriction"
$name ne "extension"
$name ne "restriction"
Truth table100%3/3
A and B
A= $name ne "extension"B= $name ne "restriction"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | , name => $name, where => $tree->path, _class => 'schema' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | if $name ne 'extension' && $name ne 'restriction'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 32 | $tree = $tree->descend; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 32 | $node = $tree->node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 32 | ▶ | my $base = $node->getAttribute('base') || $self->anyType($node); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$node->getAttribute('base') || $self->anyType($node)
MC/DC0%0/2
$node->getAttribute('base') || $self->anyType($node)
$node->getAttribute('base')
$self->anyType($node)
Truth table33%1/3
A || B
A= $node->getAttribute('base')B= $self->anyType($node)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | 32 | my $type = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 32 | my $where = $tree->path . '#cce'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | 32 | ▶ | if($base !~ m/\banyType$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | 32 | { my $typename = $self->rel2abs($where, $node, $base); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 32 | ▶ | if($type = $self->blocked($where, complexType => $typename)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | { # blocked base type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 28 | ▶ | { my $typedef = $self->namespaces->find(complexType => $typename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | or error __x"unknown base type '{type}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | , type => $typename, where => $tree->path, _class => 'schema'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | 28 | local $self->{_context} = $self->nsContext($typedef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | 28 | $type = $self->complexType($tree->descend($typedef->{node})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 32 | my $own = $self->complexBody($tree, $mixed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | 32 | $self->extendAttrs($type, $own); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 32 | ▶ | if($name eq 'extension') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | 28 | ▶ | { push @{$type->{elems}}, @{$own->{elems} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$own->{'elems'} || []
MC/DC0%0/1
$own->{'elems'} || []
$own->{'elems'}
Truth table50%1/2
A
A= $own->{'elems'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | else # restriction | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 4 | { $type->{elems} = $own->{elems}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | 32 | ▶ | $type->{mixed} ||= $own->{mixed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$type->{"mixed"} ||= $own->{"mixed"}
MC/DC0%0/2
$type->{"mixed"} ||= $own->{"mixed"}
$type->{"mixed"}
$own->{"mixed"}
Truth table33%1/3
A ||= B
A= $type->{"mixed"}B= $own->{"mixed"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | 32 | $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | # Helper routines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | # print $self->rel2abs($path, $node, '{ns}type') -> '{ns}type' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | # print $self->rel2abs($path, $node, 'prefix:type') -> '{ns-of-prefix}type' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | sub rel2abs($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | 2251 | ▶ | { my ($self, $where, $node, $type) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rel2abs: called CC=6 SCAR=18.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 2251 | ▶ | return $type if substr($type, 0, 1) eq '{'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | 2251 | ▶ | my ($prefix, $local) = $type =~ m/^(.+?)\:(.*)/ ? ($1, $2) : ('', $type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | 2251 | my $uri = $node->lookupNamespaceURI($prefix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | 2251 | ▶ | $self->_registerNSprefix($prefix, $uri, 0) if $uri; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | 2251 | ▶ | error __x"No namespace for prefix `{prefix}' in `{type}' at {where}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
length $prefix and not defined $uri
MC/DC0%0/2
length $prefix and not defined $uri
length $prefix
not defined $uri
Truth table66%2/3
A and not(B)
A= length $prefixB= not defined $uri
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | , prefix => $prefix, type => $type, where => $where, _class => 'schema' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | if length $prefix && !defined $uri; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | 2251 | pack_type $uri, $local; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | sub _registerNSprefix($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 2489 | ▶ | { my ($self, $prefix, $uri, $used) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_registerNSprefix: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | 2489 | my $table = $self->{prefixes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 2489 | ▶ | if(my $u = $table->{$uri}) # namespace already has a prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 1334 | { $u->{used} += $used; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | 1334 | return $u->{prefix}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 1155 | my %prefs = map +($_->{prefix} => 1), values %$table; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | 1155 | my $take; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | 1155 | ▶ | if(defined $prefix && !$prefs{$prefix}) { $take = $prefix } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
defined $prefix and not $prefs{$prefix}
MC/DC50%1/2
defined $prefix and not $prefs{$prefix}
defined $prefix
not $prefs{$prefix}
Truth table66%2/3
A and not(B)
A= defined $prefixB= not $prefs{$prefix}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | 0 | elsif(!$prefs{''}) { $take = '' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | { # prefix already in use; create a new x\d+ prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | 420 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | 420 | ▶ | $count++ while exists $prefs{"x$count"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | 420 | $take = 'x'.$count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | 1155 | $table->{$uri} = {prefix => $take, uri => $uri, used => $used}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | 1155 | $take; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | sub anyType($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | 15 | ▶ | { my ($self, $node) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
anyType: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 15 | pack_type $node->namespaceURI, 'anyType'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | sub findHooks($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | 1886 | ▶ | { my ($self, $path, $type, $node) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
findHooks: called CC=28 SCAR=35.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | # where is before, replace, after | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | 1886 | my %hooks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | 1886 | foreach my $hook (@{$self->{hooks}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | 61 | { my $match; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | $match++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | if !$hook->{path} && !$hook->{id} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 61 | ▶ | && !$hook->{type} && !$hook->{extends}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$hook->{"path"} or $hook->{"id"} or $hook->{"type"} or $hook->{"extends"}
$hook->{"path"} or $hook->{"id"} or $hook->{"type"}
$hook->{"path"} or $hook->{"id"}
MC/DC0%0/4
$hook->{"path"} or $hook->{"id"} or $hook->{"type"} or $hook->{"extends"}
$hook->{"path"}
$hook->{"id"}
$hook->{"type"}
$hook->{"extends"}
Truth table60%3/5
A or B or C or D
A= $hook->{"path"}B= $hook->{"id"}C= $hook->{"type"}D= $hook->{"extends"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | 61 | ▶ | if(!$match && $hook->{path}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $match and $hook->{"path"}
MC/DC50%1/2
not $match and $hook->{"path"}
not $match
$hook->{"path"}
Truth table66%2/3
not(A) and B
A= not $matchB= $hook->{"path"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | 8 | { my $p = $hook->{path}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | $match++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | 8 | ▶ | if first {ref $_ eq 'Regexp' ? $path =~ $_ : $path eq $_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | 8 | ▶ | ref $p eq 'ARRAY' ? @$p : $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 61 | ▶ | my $id = !$match && $hook->{id} && $node->getAttribute('id'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
!$match && $hook->{'id'} && $node->getAttribute('id')
not $match and $hook->{"id"}
MC/DC100%3/3
!$match && $hook->{'id'} && $node->getAttribute('id')
not $match
$hook->{"id"}
$node->getAttribute('id')
Truth table100%4/4
not(A) and B && C
A= not $matchB= $hook->{"id"}C= $node->getAttribute('id')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | 61 | ▶ | if($id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | 15 | { my $i = $hook->{id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | $match++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | 15 | ▶ | if first {ref $_ eq 'Regexp' ? $id =~ $_ : $id eq $_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 15 | ▶ | ref $i eq 'ARRAY' ? @$i : $i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 61 | ▶ | if(!$match && defined $type && $hook->{type}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not $match and defined $type and $hook->{"type"}
not $match and defined $type
MC/DC66%2/3
not $match and defined $type and $hook->{"type"}
not $match
defined $type
$hook->{"type"}
Truth table75%3/4
not(A) and B and C
A= not $matchB= defined $typeC= $hook->{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | 36 | { my $t = $hook->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 36 | my ($ns, $local) = unpack_type $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | $match++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | 36 | ▶ | if first {ref $_ eq 'Regexp' ? $type =~ $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.2
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | : substr($_,0,1) eq '{' ? $type eq $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | : $local eq $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | 36 | ▶ | } ref $t eq 'ARRAY' ? @$t : $t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | 61 | ▶ | if(!$match && defined $type && $hook->{extends}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not $match and defined $type and $hook->{"extends"}
not $match and defined $type
MC/DC0%0/3
not $match and defined $type and $hook->{"extends"}
not $match
defined $type
$hook->{"extends"}
Truth table50%2/4
not(A) and B and C
A= not $matchB= defined $typeC= $hook->{"extends"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | 0 | ▶ | { $match++ if $self->{nss}->doesExtend($type, $hook->{extends}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | 61 | ▶ | $match or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | 23 | foreach my $where ( qw/before replace after/ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 69 | ▶ | { my $w = $hook->{$where} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | 29 | ▶ | push @{$hooks{$where}}, ref $w eq 'ARRAY' ? @$w : $w; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | 1886 | @hooks{ qw/before replace after/ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | # Namespace blocks, in most cases because the schema refers to an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | # older version of itself, which is deprecated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | # performance is important, because it is called increadably often. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | sub decodeBlocked($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 779 | ▶ | { my ($self, $what) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decodeBlocked: called CC=7 SCAR=25.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 779 | ▶ | defined $what or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | 779 | my @blocked; # code-refs called with ($type, $ns, $local, $path) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 779 | ▶ | foreach my $w (ref $what eq 'ARRAY' ? @$what : $what) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | { push @blocked, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | 86 | ▶ | !ref $w ? sub { $_[0] eq $w || $_[1] eq $w } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | : ref $w eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | 0 | ▶ | ? sub { defined $w->{$_[0]} ? $w->{$_[0]} : $w->{$_[1]} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | 30 | ▶ | : ref $what eq 'CODE' ? $w | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | : error __x"blocking rule with {what} not supported", what => $w; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | 779 | \@blocked; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | sub blocked($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | 2145 | ▶ | { my ($self, $path, $class, $type) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
blocked: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | # $class = simpleType, complexType, or ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | 2145 | ▶ | @{$self->{blocked_nss}} or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | 86 | my ($ns, $local) = unpack_type $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | 86 | my $is_blocked; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | 86 | foreach my $blocked ( @{$self->{blocked_nss}} ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | 86 | { $is_blocked = $blocked->($type, $ns, $local, $path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | 86 | ▶ | last if defined $is_blocked; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | 86 | ▶ | $is_blocked or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | 38 | trace "$type of $class is blocked"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | 38 | $self->makeBlocked($path, $class, $type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | sub addTypeAttribute($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | 0 | ▶ | { my ($self, $type, $call) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
addTypeAttribute: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | 0 | $call; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | #------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | 50 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||