Branch Coverage

lib/XML/Compile/Translate.pm
Criterion Covered Total %
branch 378 532 71.0


line true false branch
51 0 779 unless my $class = $translators{$trans}
55 0 779 if $@
62 0 779 unless $self->{'nss'} = $args->{'nss'}
70 0 0 unless UNIVERSAL::isa($class, __PACKAGE__)
87 0 779 if ref $item
99 0 9 unless $nsp->find("complexType", $t) or $nsp->find("simpleType", $t)
104 0 779 if (my $def = $self->namespaces->findID($item))
115 656 121 unless my $in = $self->{'include_namespaces'}
123 0 2170 unless (defined $checker)
128 2170 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 2500 0 unless $_[1] eq 1
167 0 2081 unless $def
172 2061 20 $tns ? :
175 1843 238 if (exists $self->{'elements_qualified'})
177 0 1843 if ($qual eq 'TOP') { }
179 0 0 unless $tns
182 1741 46 $qual eq 'NONE' ? :
56 1787 $qual eq 'ALL' ? :
184 1741 102 if $qual eq "NONE"
189 22 2059 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 777 if ($internal)
220 1 1 $self->actsAs('WRITER') ? :
225 0 0 $fullname eq $path ? :
0 777 unless my $top = $nss->find('element', $fullname) || $nss->find('attribute', $fullname)
237 3344 5791 if $n->isa("XML::LibXML::Element") and $n->namespaceURI eq $schemans
247 769 8 if ($name eq 'element') { }
8 0 elsif ($name eq 'attribute') { }
249 767 0 if $make
253 8 0 if $make
279 1611 382 if ($def)
289 0 382 unless my $top = $self->namespaces->find('complexType', $typename) || $self->namespaces->find('simpleType', $typename)
298 193 0 $typedef eq 'complexType' ? :
189 193 if ($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 1914 unless my $name = $node->getAttribute("name")
579 876 1038 if ($is_global) { }
588 0 876 $self->{'abstract_types'} eq 'ACCEPT' ? :
596 8 1906 if (my $form = $node->getAttribute("form"))
597 4 0 $form eq 'unqualified' ? :
4 4 $form eq 'qualified' ? :
604 876 1038 if $is_global
605 247 1667 $qual ? :
612 1105 809 unless $is_root
618 14 1900 if (my $already = $self->{'_created'}{$nodeid})
621 0 14 if @sgs
631 12 1888 if (exists $self->{'_nest'}{$nodeid})
637 0 12 if @sgs
645 247 1641 $qual ? :
652 1369 519 if (my $isa = $node->getAttribute('type')) { }
17 502 elsif ($nr_childs == 0) { }
0 502 elsif ($nr_childs != 1) { }
654 0 1369 unless $nr_childs == 0
669 0 5 unless my $isa = $base_node->getAttribute("type")
676 12 5 unless ($comptype)
693 490 12 $ext ? :
694 104 398 $base ? :
696 385 0 $local eq 'complexType' ? :
117 385 $local eq 'simpleType' ? :
714 20 1312 @$attrs || @$attrs_any ? :
546 1332 !$is_simple ? :
8 1878 $comps->{'mixed'} ? :
726 0 1886 if $default and $fixed
729 7 1842 $fixed ? :
37 1849 $default ? :
734 7 1822 $fixed ? :
37 1829 $default ? :
20 1866 $abstract ? :
744 0 1886 if $self->{'permit_href'} and $self->actsAs("READER")
749 14 1863 if $before or $replace or $after
753 7 1879 if $comptype and $self->{'xsi_type'}{$comptype}
756 1 1885 if $self->{'xsi_type_everywhere'} and not $comptype =~ /^unnamed /
760 21 1865 if @sgs
783 1470 262 unless (defined $min)
784 26 1444 ($self->actsAs('WRITER') || $self->{'default_values'} ne 'EXTEND') && ($node->getAttribute('default') || $node->getAttribute('fixed')) ? :
790 2 1730 if $self->{'interpret_nillable_as_optional'} and $self->isTrue($node->getAttribute('nillable') || 'false')
795 1588 144 unless defined $max
797 6 1651 if $max ne "unbounded" and $max > 1 and not $self->{'check_occurs'}
800 8 1724 if $max eq "unbounded" and not $self->{'check_occurs'}
802 10 1722 if $local eq "any"
805 592 0 $local =~ /$particle_blocks/ ? :
20 592 $local eq 'group' ? :
1110 612 $local eq 'element' ? :
812 16 1706 unless defined $label
815 627 1079 if (ref $process eq "BLOCK")
825 871 208 if $min != 0
827 587 492 $self->actsAs('READER') ? :
835 79 1031 if (my $ref = $node->getAttribute("ref"))
838 12 67 if $self->blocked($where, "ref", $refname)
840 0 67 unless my $def = $self->namespaces->find("element", $refname)
866 19 608 if $kind eq "element"
880 0 20 unless my $ref = $node->getAttribute("ref")
887 0 20 if (my $blocked = $self->blocked($where, "ref", $typename))
891 0 20 unless my $dest = $self->namespaces->find("group", $typename)
895 0 20 if $group->nrChildren == 0
897 0 20 unless $group->nrChildren == 1
901 0 20 unless $local =~ /^(?:all|choice|sequence)$/
905 18 2 $code ? :
913 4 608 unless @pairs
929 4 7 if $alttype eq $type
933 0 7 unless defined $prefix
936 7 0 length $prefix ? :
956 0 21 if ("Log::Report"->needs("TRACE"))
966 21 0 if $base
970 40 0 if defined $d
978 1767 344 @_ == 1 ? :
982 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*\)$/) { }
984 4 10 if defined $r->{$full}
985 0 14 if defined $r->{$key}
1000 25 4 $p->{$ns} ? :
1001 17 12 if $prefix ne ""
1006 0 0 $p->{$ns} ? :
1007 0 0 if grep {$prefix eq $_;} @l
1014 69 2042 if $key ne $oldkey
1025 0 1004 unless defined $ns
1027 735 269 unless my $pn = $self->{'prefixes'}{$ns}
1028 138 131 unless $hide_use
1029 233 36 length $pn->{'prefix'} ? :
1034 0 0 unless my $def = $self->{'prefixes'}{$ns}
1051 5 256 if (my $refattr = $node->getAttribute("ref"))
1054 0 5 if $self->blocked($where, "ref", $refname)
1056 0 5 unless my $def = $self->namespaces->find("attribute", $refname)
1065 0 256 unless my $name = $node->getAttribute("name")
1071 13 243 if ($is_global) { }
1084 13 243 if $is_global
1086 0 256 if (my $form = $node->getAttribute("form"))
1087 0 0 $form eq 'unqualified' ? :
0 0 $form eq 'qualified' ? :
1101 7 249 if ($tree->nrChildren == 1) { }
1102 0 7 unless $tree->currentLocal eq "simpleType"
1110 0 249 unless $name = $node->getAttribute("name")
1117 249 7 unless ($type)
1118 246 3 defined $typeattr ? :
1127 0 256 unless my $st = $type->{'st'}
1130 8 248 $qual ? :
1131 8 248 $qual ? :
1135 0 256 unless $use =~ /^(?:optional|required|prohibited|)$/
1142 6 196 $use eq 'prohibited' ? :
29 202 $use eq 'required' ? :
11 231 defined $fixed ? :
14 242 defined $default ? :
1149 14 242 defined $default ? :
1152 256 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 605 if $self->{'mixed_elements'} eq "STRUCTURAL"
1282 24 582 unless my $first = $tree->firstChild
1286 526 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 558 unless $tree->currentChild
1315 526 32 if ($tree->currentLocal =~ /$particle_blocks/)
1322 0 558 if defined $tree->currentChild
1342 248 16 if ($name eq 'attribute') { }
6 10 elsif ($name eq 'attributeGroup') { }
1368 0 22 unless $tree->nrChildren == 1
1372 14 8 if $name eq "extension"
1375 8 0 if $name eq "restriction"
1395 14 0 defined $base ? :
1400 0 14 unless defined $basetype->{'st'}
1404 0 14 if $tree->currentChild
1424 4 4 if ($first eq 'simpleType') { }
4 0 elsif (my $basename = $node->getAttribute('base')) { }
1439 0 8 unless my $st = $type->{'st'}
1446 0 8 if $tree->currentChild
1460 0 33 if (my $m = $node->getAttribute("mixed"))
1462 0 0 if $self->{'mixed_elements'} ne "STRUCTURAL"
1465 0 33 unless $tree->nrChildren == 1
1470 1 32 if $name ne "extension" and $name ne "restriction"
1480 32 0 unless ($base =~ /\banyType$/)
1482 4 28 if ($type = $self->blocked($where, 'complexType', $typename)) { }
1486 0 28 unless my $typedef = $self->namespaces->find("complexType", $typename)
1498 28 4 if ($name eq 'extension') { }
1499 0 28 unless $own->{'elems'}
1518 0 2251 if substr($type, 0, 1) eq "{"
1520 631 1620 $type =~ /^(.+?)\:(.*)/ ? :
1522 2247 4 if $uri
1524 0 2251 if length $prefix and not defined $uri
1535 1334 1155 if (my $u = $table->{$uri})
1542 735 420 if (defined $prefix and not $prefs{$prefix}) { }
0 420 elsif (not $prefs{''}) { }
1569 0 0 unless $hook->{'path'} or $hook->{'id'} or $hook->{'type'} or $hook->{'extends'}
1571 8 53 if (not $match and $hook->{'path'})
1574 8 0 ref $_ eq 'Regexp' ? :
1575 0 8 ref $p eq 'ARRAY' ? :
2 6 if &first(sub { ref $_ eq "Regexp" ? $path =~ /$_/ : $path eq $_; } , ref $p eq "ARRAY" ? @$p : $p)
1579 15 46 if ($id)
1582 0 15 ref $_ eq 'Regexp' ? :
1583 0 15 ref $i eq 'ARRAY' ? :
8 7 if &first(sub { ref $_ eq "Regexp" ? $id =~ /$_/ : $id eq $_; } , ref $i eq "ARRAY" ? @$i : $i)
1586 36 15 if (not $match and defined $type and $hook->{'type'})
1590 32 4 substr($_, 0, 1) eq '{' ? :
0 36 if (ref $_ eq 'Regexp') { }
1593 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)
1596 0 38 if (not $match and defined $type and $hook->{'extends'})
1597 0 0 if $self->{'nss'}->doesExtend($type, $hook->{'extends'})
1600 38 23 unless $match
1603 40 29 unless my $w = $hook->{$where}
1604 4 25 ref $w eq 'ARRAY' ? :
1617 0 779 unless defined $what
1619 779 0 ref $what eq 'ARRAY' ? :
1621 86 0 unless $_[0] eq $w
1623 0 0 defined $$w{$_[0]} ? :
1624 0 0 ref $what eq 'CODE' ? :
0 0 ref $w eq 'HASH' ? :
30 0 !ref($w) ? :
1633 2059 86 unless @{$self->{'blocked_nss'};}
1639 86 0 if defined $is_blocked
1641 48 38 unless $is_blocked