File Coverage

blib/lib/XML/DOM2/Element/Document.pm
Criterion Covered Total %
statement 10 15 66.6
branch 1 4 25.0
condition 0 6 0.0
subroutine 3 4 75.0
pod 1 1 100.0
total 15 30 50.0


line stmt bran cond sub pod time code
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 3     3   18 use base "XML::DOM2::Element";
  3         6  
  3         247  
17 3     3   18 use Carp;
  3         6  
  3         786  
18              
19             =head2 $class->new( %arguments )
20              
21             Create a new document object.
22              
23             =cut
24             sub new
25             {
26 2     2 1 8 my ($proto, %args) = @_;
27 2 50       12 confess "Unable to create a new document element with no document!" if not $args{'document'};
28 2         29 my $doc = $proto->SUPER::new($args{'documentTag'}, %args);
29 2         12 return $doc;
30             }
31              
32             =head2 $element->_attribute_handle( $name, %arguments )
33              
34             Handle document attributes
35              
36             =cut
37             sub _attribute_handle
38             {
39 0     0     my ($self, $name, %opts) = @_;
40 0           my $ns = $opts{'namespace'};
41 0 0 0       if($name eq 'xmlns' or ($ns and $ns->ns_prefix eq 'xmlns')) {
      0        
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, L, L
54              
55             L DOM at the W3C
56              
57             =cut
58              
59             return 1;