Branch Coverage

lib/XML/Compile/Translate.pm
Criterion Covered Total %
branch 373 528 70.6


line true false branch
51 0 771 unless my $class = $translators{$trans}
55 0 771 if $@
62 0 771 unless $self->{'nss'} = $args->{'nss'}
70 0 0 unless UNIVERSAL::isa($class, 'XML::Compile::Translate')
87 0 771 if ref $item
99 0 9 unless $nsp->find('complexType', $t) or $nsp->find('simpleType', $t)
104 0 771 if (my $def = $self->namespaces->findID($item))
115 648 121 unless my $in = $self->{'include_namespaces'}
123 0 2134 unless (defined $checker)
128 2134 0 if &$checker($value)
139 54 0 if (my $a = $add->{'attrs'})
142 24 30 unless $in->{'attrs'}
0 54 unless $add->{'attrs'}
145 0 80 if ($code{$type}) { }
157 54 0 if $add->{'attrs_any'}
161 2452 0 unless $_[1] eq '1'
167 0 2055 unless $def
172 2035 20 $tns ? :
175 1817 238 if (exists $self->{'elements_qualified'})
177 0 1817 if ($qual eq 'TOP') { }
179 0 0 unless $tns
182 1715 46 $qual eq 'NONE' ? :
56 1761 $qual eq 'ALL' ? :
184 1715 102 if $qual eq 'NONE'
189 22 2033 if (exists $self->{'attributes_qualified'})
191 0 22 if ($qual eq 'TOP') { }
192 0 0 unless $tns
195 0 22 $qual eq 'NONE' ? :
0 22 $qual eq 'ALL' ? :
215 2 769 if ($internal)
220 1 1 $self->actsAs('WRITER') ? :
225 0 0 $fullname eq $path ? :
0 769 unless my $top = $nss->find('element', $fullname) || $nss->find('attribute', $fullname)
237 3286 5687 if $n->isa('XML::LibXML::Element') and $n->namespaceURI eq $schemans
247 761 8 if ($name eq 'element') { }
8 0 elsif ($name eq 'attribute') { }
249 759 0 if $make
253 8 0 if $make
279 1589 380 if ($def)
289 0 380 unless my $top = $self->namespaces->find('complexType', $typename) || $self->namespaces->find('simpleType', $typename)
298 191 0 $typedef eq 'complexType' ? :
189 191 $typedef eq 'simpleType' ? :
307 0 372 unless $tree->nrChildren == 1
319 37 0 $name eq 'union' ? :
56 37 $name eq 'list' ? :
279 93 $name eq 'restriction' ? :
340 40 16 if (my $type = $node->getAttribute('itemType')) { }
341 0 40 unless $tree->nrChildren == 0
350 0 16 unless $tree->nrChildren == 1
354 0 16 unless $tree->currentLocal eq 'simpleType'
362 0 56 unless my $st = $per_item->{'st'}
386 27 10 if (my $members = $node->getAttribute('memberTypes'))
392 0 43 unless my $st = $type->{'st'}
401 0 39 unless $name eq 'simpleType'
423 279 0 if (my $basename = $node->getAttribute('base')) { }
429 0 0 unless my $simple = $tree->firstChild
433 0 0 unless $simple->localName eq 'simpleType'
439 0 0 if (my($r) = $simple->getChildrenByLocalName('restriction'))
442 0 0 if $r
449 0 279 unless my $st = $base->{'st'}
455 0 279 if $tree->currentChild
484 8 272 if $facet =~ /$attribute_defs/
487 0 272 unless defined $value
491 88 184 if ($facet eq 'enumeration') { }
30 154 elsif ($facet eq 'pattern') { }
154 0 elsif (not exists $facets{$facet}) { }
492 62 26 unless defined $is_qname
495 10 78 if ($is_qname)
497 10 0 $value =~ /\:/ ? :
515 77 210 if $self->{'ignore_facets'} or not keys %facets
523 3 207 if (defined $facets{'totalDigits'} and defined $facets{'fractionDigits'})
530 101 109 $self->actsAs('WRITER') ? :
533 2 241 unless my $h = &builtin_facet($where, $self, $facet, $facets{$facet}, $is_list, $type, $nss, $action)
535 34 207 if ($facets_early{$facet}) { }
541 23 187 $is_list ? :
563 0 1880 unless my $name = $node->getAttribute('name')
579 860 1020 if ($is_global) { }
588 0 860 $self->{'abstract_types'} eq 'ACCEPT' ? :
596 8 1872 if (my $form = $node->getAttribute('form'))
597 4 0 $form eq 'unqualified' ? :
4 4 $form eq 'qualified' ? :
604 860 1020 if $is_global
605 247 1633 $qual ? :
612 1083 797 unless $is_root
618 14 1866 if (my $already = $self->{'_created'}{$nodeid})
621 0 14 if @sgs
631 12 1854 if (exists $self->{'_nest'}{$nodeid})
637 0 12 if @sgs
645 247 1607 $qual ? :
652 1347 507 if (my $isa = $node->getAttribute('type')) { }
17 490 elsif ($nr_childs == 0) { }
0 490 elsif ($nr_childs != 1) { }
654 0 1347 unless $nr_childs == 0
671 0 5 unless my $isa = $base_node->getAttribute('type')
679 12 5 unless ($comptype)
694 373 0 $local eq 'complexType' ? :
117 373 $local eq 'simpleType' ? :
713 20 1292 @$attrs || @$attrs_any ? :
532 1312 !$is_simple ? :
8 1844 $comps->{'mixed'} ? :
725 0 1852 if $default and $fixed
729 7 1808 $fixed ? :
37 1815 $default ? :
734 7 1790 $fixed ? :
37 1797 $default ? :
18 1834 $abstract ? :
744 0 1852 if $self->{'permit_href'} and $self->actsAs('READER')
750 14 1829 if $before or $replace or $after
754 7 1845 if $comptype and $self->{'xsi_type'}{$comptype}
757 1 1851 if $self->{'xsi_type_everywhere'} and not $comptype =~ /^unnamed /
761 19 1833 if @sgs
784 1430 262 unless (defined $min)
785 26 1404 ($self->actsAs('WRITER') || $self->{'default_values'} ne 'EXTEND') && ($node->getAttribute('default') || $node->getAttribute('fixed')) ? :
791 2 1690 if $self->{'interpret_nillable_as_optional'} and $self->isTrue($node->getAttribute('nillable') || 'false')
796 1552 140 unless defined $max
798 6 1615 if $max ne 'unbounded' and $max > 1 and not $self->{'check_occurs'}
801 8 1684 if $max eq 'unbounded' and not $self->{'check_occurs'}
803 10 1682 if $local eq 'any'
806 578 0 $local =~ /$particle_blocks/ ? :
16 578 $local eq 'group' ? :
1088 594 $local eq 'element' ? :
813 12 1670 unless defined $label
816 611 1059 if (ref $process eq 'BLOCK')
826 851 208 if $min != 0
828 577 482 $self->actsAs('READER') ? :
836 75 1013 if (my $ref = $node->getAttribute('ref'))
839 12 63 if $self->blocked($where, 'ref', $refname)
841 0 63 unless my $def = $self->namespaces->find('element', $refname)
867 17 594 if $kind eq 'element'
882 0 16 unless my $ref = $node->getAttribute('ref')
887 0 16 if (my $blocked = $self->blocked($where, 'ref', $typename))
891 0 16 unless my $dest = $self->namespaces->find('group', $typename)
896 0 16 if $group->nrChildren == 0
898 0 16 unless $group->nrChildren == 1
903 0 16 unless $local =~ /^(?:all|choice|sequence)$/
916 0 594 unless @pairs
932 4 7 if $alttype eq $type
936 0 7 unless defined $prefix
939 7 0 length $prefix ? :
959 0 19 if ('Log::Report'->needs('TRACE'))
969 19 0 if $base
973 36 0 if defined $d
981 1725 342 @_ == 1 ? :
985 14 101 if (ref $r eq 'HASH') { }
51 50 elsif (ref $r eq 'CODE') { }
0 50 elsif ($r eq 'UNDERSCORES') { }
21 29 elsif ($r eq 'SIMPLIFIED') { }
29 0 elsif ($r eq 'PREFIXED') { }
0 0 elsif ($r =~ /^PREFIXED\(\s*(.*?)\s*\)$/) { }
987 4 10 if defined $r->{$full}
988 0 14 if defined $r->{$key}
1003 25 4 $p->{$ns} ? :
1004 17 12 if $prefix ne ''
1009 0 0 $p->{$ns} ? :
1010 0 0 if grep {$prefix eq $_;} @l
1017 69 1998 if $key ne $oldkey
1026 0 988 unless defined $ns
1028 727 261 unless my $pn = $self->{'prefixes'}{$ns}
1029 138 123 unless $hide
1030 225 36 length $pn->{'prefix'} ? :
1035 0 8 unless my $def = $self->{'prefixes'}{$ns}
1052 5 254 if (my $refattr = $node->getAttribute('ref'))
1055 0 5 if $self->blocked($where, 'ref', $refname)
1057 0 5 unless my $def = $self->namespaces->find('attribute', $refname)
1066 0 254 unless my $name = $node->getAttribute('name')
1072 13 241 if ($is_global) { }
1085 13 241 if $is_global
1087 0 254 if (my $form = $node->getAttribute('form'))
1088 0 0 $form eq 'unqualified' ? :
0 0 $form eq 'qualified' ? :
1096 0 8 if $qual and $ns and $self->prefixForNamespace($ns) eq ''
1101 7 247 if ($tree->nrChildren == 1) { }
1102 0 7 unless $tree->currentLocal eq 'simpleType'
1110 0 247 unless $name = $node->getAttribute('name')
1117 247 7 unless ($type)
1118 244 3 defined $typeattr ? :
1127 0 254 unless my $st = $type->{'st'}
1130 8 246 $qual ? :
1131 8 246 $qual ? :
1135 0 254 unless $use =~ /^(?:optional|required|prohibited|)$/
1142 6 194 $use eq 'prohibited' ? :
29 200 $use eq 'required' ? :
11 229 defined $fixed ? :
14 240 defined $default ? :
1149 14 240 defined $default ? :
1152 254 0 defined $do ? :
1163 0 6 unless my $ref = $node->getAttribute('ref')
1168 0 6 if $self->blocked($where, 'ref', $typename)
1170 0 6 unless my $def = $self->namespaces->find('attributeGroup', $typename)
1198 0 10 if $^W and $node->getAttribute('notQName')
1203 9 1 defined $do ? :
1225 0 10 if $^W and $node->getAttribute('notQName')
1240 8 12 if $include eq '##any'
1243 4 8 if $include eq '##other'
1248 8 8 if (defined $list and length $list)
1250 0 0 $uri eq '##local' ? :
8 0 $uri eq '##targetNamespace' ? :
1256 8 8 @list ? :
1280 1 591 if $self->{'mixed_elements'} eq 'STRUCTURAL'
1282 24 568 unless my $first = $tree->firstChild
1286 512 56 if $name =~ /$particle_blocks/ or $name =~ /$attribute_defs/
1289 0 56 unless $tree->nrChildren == 1
1293 22 34 if $name eq 'simpleContent'
1296 33 1 if $name eq 'complexContent'
1306 0 544 unless $tree->currentChild
1315 512 32 if ($tree->currentLocal =~ /$particle_blocks/)
1322 0 544 if defined $tree->currentChild
1342 246 16 if ($name eq 'attribute') { }
6 10 elsif ($name eq 'attributeGroup') { }
1368 0 22 unless $tree->nrChildren == 1
1373 14 8 if $name eq 'extension'
1376 8 0 if $name eq 'restriction'
1396 14 0 defined $base ? :
1402 0 14 unless defined $basetype->{'st'}
1407 0 14 if $tree->currentChild
1428 4 4 if ($first eq 'simpleType') { }
4 0 elsif (my $basename = $node->getAttribute('base')) { }
1443 0 8 unless my $st = $type->{'st'}
1450 0 8 if $tree->currentChild
1464 0 33 if (my $m = $node->getAttribute('mixed'))
1466 0 0 if $self->{'mixed_elements'} ne 'STRUCTURAL'
1469 0 33 unless $tree->nrChildren == 1
1474 1 32 if $name ne 'extension' and $name ne 'restriction'
1484 32 0 unless ($base =~ /\banyType$/)
1486 4 28 if ($type = $self->blocked($where, 'complexType', $typename)) { }
1490 0 28 unless my $typedef = $self->namespaces->find('complexType', $typename)
1502 28 4 if ($name eq 'extension') { }
1503 0 28 unless $own->{'elems'}
1522 0 2115 if substr($type, 0, 1) eq '{'
1524 607 1508 $type =~ /^(.+?)\:(.*)/ ? :
1526 2111 4 if $uri
1528 0 2115 if length $prefix and not defined $uri
1539 1212 1141 if (my $u = $table->{$uri})
1546 724 417 if (defined $prefix and not $prefs{$prefix}) { }
0 417 elsif (not $prefs{''}) { }
1573 0 0 unless $hook->{'path'} or $hook->{'id'} or $hook->{'type'} or $hook->{'extends'}
1575 8 53 if (not $match and $hook->{'path'})
1578 8 0 ref $_ eq 'Regexp' ? :
1579 0 8 ref $p eq 'ARRAY' ? :
2 6 if &first(sub { ref $_ eq 'Regexp' ? $path =~ /$_/ : $path eq $_; } , ref $p eq 'ARRAY' ? @$p : $p)
1583 15 46 if ($id)
1586 0 15 ref $_ eq 'Regexp' ? :
1587 0 15 ref $i eq 'ARRAY' ? :
8 7 if &first(sub { ref $_ eq 'Regexp' ? $id =~ /$_/ : $id eq $_; } , ref $i eq 'ARRAY' ? @$i : $i)
1590 36 15 if (not $match and defined $type and $hook->{'type'})
1594 32 4 substr($_, 0, 1) eq '{' ? :
0 36 ref $_ eq 'Regexp' ? :
1597 0 36 ref $t eq 'ARRAY' ? :
13 23 if &first(sub { ref $_ eq 'Regexp' ? $type =~ /$_/ : (substr($_, 0, 1) eq '{' ? $type eq $_ : $local eq $_); } , ref $t eq 'ARRAY' ? @$t : $t)
1600 0 38 if (not $match and defined $type and $hook->{'extends'})
1601 0 0 if $self->{'nss'}->doesExtend($type, $hook->{'extends'})
1604 38 23 unless $match
1607 40 29 unless my $w = $hook->{$where}
1608 4 25 ref $w eq 'ARRAY' ? :
1621 0 771 unless defined $what
1623 771 0 ref $what eq 'ARRAY' ? :
1625 86 0 unless $_[0] eq $w
1627 0 0 defined $$w{$_[0]} ? :
1628 0 0 ref $what eq 'CODE' ? :
0 0 ref $w eq 'HASH' ? :
30 0 !ref($w) ? :
1637 2027 86 unless @{$self->{'blocked_nss'};}
1643 86 0 if defined $is_blocked
1645 48 38 unless $is_blocked