Branch Coverage

blib/lib/XML/Smart/DTD.pm
Criterion Covered Total %
branch 142 236 60.1


line true false branch
83 84 0 if $$this{'tree'}{$tag}
94 3 66 unless $$this{'tree'}{$tag} and $$this{'tree'}{$tag}{'children'}
95 39 27 if $$this{'tree'}{$tag}{'children'}{$child}
105 3 0 $this->get_elem_opt(@_) =~ /^[\!]?$/ ? :
114 0 0 $this->get_elem_child_opt(@_) =~ /^[\!]?$/ ? :
123 3 0 $this->get_elem_opt(@_) =~ /^[\+\*]$/ ? :
132 6 3 $this->get_elem_child_opt(@_) =~ /^[\+\*]$/ ? :
141 3 3 $this->get_elem_opt(@_) =~ /^[\!\+]?$/ ? :
150 33 21 $this->get_elem_child_opt(@_) =~ /^[\!\+]?$/ ? :
159 3 0 $this->get_elem_opt(@_) =~ /^[\?\*]$/ ? :
168 0 0 $this->get_elem_child_opt(@_) =~ /^[\?\*]$/ ? :
178 0 15 unless $$this{'tree'}{$tag}
189 0 63 unless $$this{'tree'}{$tag} and $$this{'tree'}{$tag}{'children'}
200 0 0 unless $$this{'tree'}{$tag}
202 0 0 if $$this{'tree'}{$tag}{'any'}
213 0 45 unless $$this{'tree'}{$tag}
214 30 15 if $$this{'tree'}{$tag}{'content'}
224 0 48 unless $$this{'tree'}{$tag}
226 6 42 if $$this{'tree'}{$tag}{'empty'}
237 0 0 unless $$this{'tree'}{$tag}
239 0 0 ref $$this{'tree'}{$tag}{'parent'} eq 'ARRAY' ? :
243 0 0 if $chk_parent_i eq ''
244 0 0 unless $parents{$chk_parent_i}
257 0 42 unless $$this{'tree'}{$tag}
260 3 45 unless $$this{'tree'}{$tag}{'attributes'}{$attrs_i}
277 3 36 unless $$this{'tree'}{$tag} and $attr_check
281 30 6 if $opt and $opt =~ /#REQUIRED/i
292 0 0 unless $$this{'tree'}{$tag} and $$this{'tree'}{$tag}{'attributes'}{$attr}
296 0 0 if $opt =~ /#FIXED/i
307 0 0 unless $$this{'tree'}{$tag} and $$this{'tree'}{$tag}{'attributes'}{$attr}
321 0 6 unless $$this{'tree'}{$tag} and $$this{'tree'}{$tag}{'attributes'}{$attr}
333 0 0 unless $$this{'tree'}{$tag} and $$this{'tree'}{$tag}{'attributes'}{$attr}
336 0 0 if ref $vals eq 'ARRAY'
347 0 30 unless $$this{'tree'}{$tag}
348 30 0 if $$this{'tree'}{$tag}{'childrenARR'} and @{$$this{'tree'}{$tag}{'childrenARR'};}
364 33 21 if $this->is_elem_child_req($tag, $child_i)
377 6 30 unless $$this{'tree'}{$tag} and $$this{'tree'}{$tag}{'attr_order'}
395 30 9 if $this->is_attr_req($tag, $attrs_i)
408 6 0 if (@_)
410 6 0 if $$this{'ERRORS'} and @{$$this{'ERRORS'};}
441 0 0 unless $percent
452 0 0 unless $percent
458 0 0 exists $definitions{$1} ? :
459 0 9 if $xml =~ /([&%]$name);/
471 27 18 if ($children eq '(#PCDATA)') { }
0 18 elsif ($children =~ s/^\((#PCDATA(?:\|$name)+)\)$/$1/o and $option eq '*') { }
478 0 45 unless $children =~ /^#?$nameX(?:,$nameX)*$/
483 36 39 unless $child =~ s/([\?\*\+])$// and $option = $1
488 48 27 unless $child eq '#PCDATA'
491 27 18 unless @{$elements{$element}{'childrenARR'};}
496 0 6 if (uc $param eq 'ANY') { }
6 0 elsif (uc $param eq 'EMPTY') { }
503 0 15 unless exists $elements{$element}
508 9 24 if ($default and $default =~ /^"(.*?)"$/) { }
0 48 elsif ($default and $default =~ /^'(.*?)'$/) { }
515 9 24 if ($type =~ /^(?:NOTATION\s*)?\(\s*(.*?)\)$/)
523 9 0 if ($xml =~ /^\s*<\!DOCTYPE\s+($name)\s*\[\s*(.*)$/)
530 0 9 if $xml =~ /\S/
534 27 48 if ($child eq '#PCDATA') { }
539 6 42 unless exists $elements{$child}
541 3 45 if (exists $elements{$child}{'parent'}) { }
548 33 18 unless (%{$elements{$element}{'children'};})
560 4 0 unless (@_)
583 0 0 exists $definitions{$1} ? :
584 0 4 if $xml =~ /([&%]$name);/
602 4 0 if ($xml =~ /^\s*<\!DOCTYPE\s+($name)\s*\[\s*/)
616 3 15 if ($children =~ /\|/)
621 0 18 if ($option)
638 0 18 if ($option)
671 3 102 if (defined $1) { }
30 72 elsif (defined $2) { }
673 3 0 if ($q =~ /^"(.*?)"$/) { }
0 0 elsif ($q =~ /^'(.*?)'$/) { }
700 0 13 if (ref $_[0] eq 'GLOB') { }
0 13 elsif ($_[0] =~ m[^http://\w+[^\r\n]+$]s) { }
13 0 elsif ($_[0] =~ /<.*?>/s) { }
705 0 13 if ($fh)
707 0 0 if $open
724 6 0 if (ref $dtd ne 'XML::Smart::DTD')
728 0 6 unless $dtd and $dtd->tree and %{$dtd->tree;}
740 57 9 if (ref $tree)
741 0 57 if ($$parsed{"$tree"})
748 51 15 if (ref $tree eq 'HASH') { }
6 9 elsif (ref $tree eq 'ARRAY') { }
750 45 6 if ($tag ne '' and $dtd->elem_exists($tag))
751 3 42 if ($dtd->is_elem_empty($tag)) { }
27 15 elsif ($dtd->is_elem_pcdata($tag)) { }
755 12 15 unless defined $$prev_tree{$tag}{'CONTENT'}
27 0 if (ref $$prev_tree{$tag} eq 'HASH') { }
756 0 0 unless defined $$prev_tree{$tag}
761 9 24 unless (exists $$tree{$childs_req_i})
768 3 21 unless (exists $$tree{$attrs_req_i})
776 10 5 if (not $$tree{'/order'}) { }
792 20 0 if $order{$order_i}
807 47 75 if ($Key eq '' or $Key eq '/order' or $Key eq '/nodes' or $Key eq 'CONTENT')
809 45 30 if ($tag eq '' and $dtd->elem_exists($Key) or $tag ne '' and $dtd->child_exists($tag, $Key)) { }
30 0 elsif ($tag ne '' and $dtd->attr_exists($tag, $Key)) { }
810 0 45 if ($$tree{'/nodes'}{$Key} and $$tree{'/nodes'}{$Key} =~ /^(\w+,\d+),(\d*)/) { }
813 18 27 if (not ref $$tree{$Key}) { }
9 18 elsif (ref $$tree{$Key} eq 'ARRAY') { }
814 15 3 $$tree{$Key} ? :
815 18 0 unless ref $$tree{$Key}
816 15 3 if $content ne ''
819 3 6 if ($tag ne '' and not $dtd->is_elem_child_multi($tag, $Key))
827 0 3 if (ref $$tree{$Key} eq 'HASH' and exists $$tree{$Key}{'CONTENT'} and keys %{$$tree{$Key};} == 1)
832 3 27 if (ref $$tree{$Key})
833 0 3 if (ref $$tree{$Key} eq 'ARRAY')
834 3 0 if (ref $$tree{$Key} eq 'HASH')
837 3 27 if ($tag ne '' and $$tree{$Key} eq '')
842 0 0 if ($prev_exists and not $opts{'no_delete'}) { }
858 9 0 if ($tag ne '' and $dtd->elem_exists($tag)) { }
0 0 elsif ($tag ne '' and $dtd->attr_exists($prev_tag, $tag)) { }
859 0 9 if ($$prev_tree{'/nodes'}{$tag} =~ /^(\w+,\d+),(\d*)/) { }
862 3 6 if (not ref $$prev_tree{$tag} or ref $$prev_tree{$tag} eq 'HASH' and not exists $$prev_tree{$tag}{'CONTENT'})
864 3 0 unless ref $$prev_tree{$tag}
865 3 0 if $content ne ''
870 0 0 if (ref $$prev_tree{$tag} eq 'HASH' and exists $$prev_tree{$tag}{'CONTENT'} and keys %{$$prev_tree{$tag};} == 1)
877 57 9 if ref $tree