DOM2/Element/Document.pm

filter: Statementstmt 68.7% 11 / 16 Branchbran 25.0% 1 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 47.0% 16 / 34 CC 5 SCAR 23.8
CC
5
Cov
46%
_attribute_handle
20.0
new
2.0
BEGIN
1.0
CRAP 10.8
« DOM2/Parser.pm ↑ Summary DOM2/DOM/Element.pm »
1 package XML::DOM2::Element::Document;
2  
3 =head1 NAME
4  
5 XML::DOM2::Element::Document
6  
7 =head1 DESCRIPTION
8  
9 Provides the document element objec with the required DOM
10 interface for document wide element requests.
11  
12 =head1 METHODS
13  
14 =cut
15  
16 4 ▶use base "XML::DOM2::Element";
Subroutine BEGIN: called CC=1 SCAR=0.0
17 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 =head2 $class->new( %arguments )
20  
21 Create a new document object.
22  
23 =cut
24 sub new
25 2 ▶{
Subroutine new: called CC=2 SCAR=7.0
Pod documented
26 2 my ($proto, %args) = @_;
27 2 ▶ confess "Unable to create a new document element with no document!" if not $args{'document'};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"document"} 0 2 2
28 2 my $doc = $proto->SUPER::new($args{'documentTag'}, %args);
29 2 return $doc;
30 }
31  
32 =head2 $element->_attribute_handle( $name, %arguments )
33  
34 Handle document attributes
35  
36 =cut
37 sub _attribute_handle
38 0 ▶{
Subroutine _attribute_handle: not called CC=4 SCAR=30.0
39 0 my ($self, $name, %opts) = @_;
40 0 my $ns = $opts{'namespace'};
41 0 ▶ if($name eq 'xmlns' or ($ns and $ns->ns_prefix eq 'xmlns')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "xmlns" or $ns and $ns->ns_prefix eq "xmlns") 0 0 0
Condition0%0/6
$name eq "xmlns" or $ns and $ns->ns_prefix eq "xmlns"
l!l&&r!l&&!r
000
$ns and $ns->ns_prefix eq "xmlns"
!ll&&!rl&&r
000
MC/DC0%0/3
$name eq "xmlns" or $ns and $ns->ns_prefix eq "xmlns"
$name eq "xmlns" $ns $ns->ns_prefix eq "xmlns"
Truth table0%0/4
A or B and C
A= $name eq "xmlns"B= $nsC= $ns->ns_prefix eq "xmlns"
ABCresult
1XX1
0111
00X0
0100
42 0 return XML::DOM2::Attribute::Namespace->new( %opts );
43 }
44 0 return $self->SUPER::_attribute_handle($name, %opts);
45 }
46  
47 =head1 AUTHOR
48  
49 Martin Owens, doctormo@postmaster.co.uk
50  
51 =head1 SEE ALSO
52  
53 perl(1), L<XML::DOM2>, L<XML::DOM2::Element>, L<XML::DOM2::DOM>
54  
55 L<http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html> DOM at the W3C
56  
57 =cut
58  
59 4 return 1;
« DOM2/Parser.pm ↑ Summary DOM2/DOM/Element.pm »