| 1 | package XML::DOM2::Attribute::Namespace; | ||||||||||
| 2 | |||||||||||
| 3 | =head1 NAME | ||||||||||
| 4 | |||||||||||
| 5 | XML::DOM2::Attribute::Namespace | ||||||||||
| 6 | |||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||
| 8 | |||||||||||
| 9 | Attribute Namespace object class | ||||||||||
| 10 | |||||||||||
| 11 | =head1 METHODS | ||||||||||
| 12 | |||||||||||
| 13 | =cut | ||||||||||
| 14 | |||||||||||
| 15 | 4 | ▶ | use base "XML::DOM2::Attribute"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 4 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | |||||||||||
| 21 | =head2 $class->new( %arguments ) | ||||||||||
| 22 | |||||||||||
| 23 | Create a new attribute namespace object. | ||||||||||
| 24 | |||||||||||
| 25 | =cut | ||||||||||
| 26 | sub new | ||||||||||
| 27 | 2 | ▶ | { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 28 | 2 | my ($proto, %opts) = @_; | |||||||||
| 29 | 2 | return $proto->SUPER::new(%opts); | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | =head2 $class->serialise() | ||||||||||
| 33 | |||||||||||
| 34 | Format and return xml text serialised. | ||||||||||
| 35 | |||||||||||
| 36 | =cut | ||||||||||
| 37 | sub serialise | ||||||||||
| 38 | 0 | ▶ | { | ||||||||
|
Subroutine
serialise: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 39 | 0 | my ($self) = @_; | |||||||||
| 40 | 0 | my $result = $self->{'value'}; | |||||||||
| 41 | 0 | return $result; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | =head2 $class->deserialise( $uri ) | ||||||||||
| 45 | |||||||||||
| 46 | Deserialise uri | ||||||||||
| 47 | |||||||||||
| 48 | =cut | ||||||||||
| 49 | sub deserialise | ||||||||||
| 50 | 0 | ▶ | { | ||||||||
|
Subroutine
deserialise: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 51 | 0 | my ($self, $uri) = @_; | |||||||||
| 52 | 0 | ▶ | if($self->{'value'}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | 0 | $self->document->removeNamespace($self); | |||||||||
| 54 | } | ||||||||||
| 55 | 0 | $self->{'value'} = $uri; | |||||||||
| 56 | 0 | $self->document->addNamespace($self); | |||||||||
| 57 | 0 | ▶ | if($self->name eq 'xmlns') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 0 | $self->document->namespace($uri); | |||||||||
| 59 | } | ||||||||||
| 60 | 0 | return $self; | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | =head2 $class->ns_prefix() | ||||||||||
| 64 | |||||||||||
| 65 | Return the namespace prefix. | ||||||||||
| 66 | |||||||||||
| 67 | =cut | ||||||||||
| 68 | sub ns_prefix | ||||||||||
| 69 | 0 | ▶ | { | ||||||||
|
Subroutine
ns_prefix: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 70 | 0 | my ($self) = @_; | |||||||||
| 71 | 0 | return $self->localName; | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | =head2 $class->ns_uri() | ||||||||||
| 75 | |||||||||||
| 76 | Return the namespace uri. | ||||||||||
| 77 | |||||||||||
| 78 | =cut | ||||||||||
| 79 | sub ns_uri | ||||||||||
| 80 | 0 | ▶ | { | ||||||||
|
Subroutine
ns_uri: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 81 | 0 | my ($self) = @_; | |||||||||
| 82 | 0 | return $self->serialise; | |||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | =head2 $class->delete() | ||||||||||
| 86 | |||||||||||
| 87 | Remove the namespace from the document. | ||||||||||
| 88 | |||||||||||
| 89 | =cut | ||||||||||
| 90 | sub delete | ||||||||||
| 91 | 0 | ▶ | { | ||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 92 | 0 | my ($self) = @_; | |||||||||
| 93 | # Make sure we remove this namespace from | ||||||||||
| 94 | # the document when we remove the namespace attribute | ||||||||||
| 95 | 0 | $self->document->removeNamespace($self); | |||||||||
| 96 | } | ||||||||||
| 97 | |||||||||||
| 98 | =head1 COPYRIGHT | ||||||||||
| 99 | |||||||||||
| 100 | Martin Owens, doctormo@cpan.org | ||||||||||
| 101 | |||||||||||
| 102 | =head1 SEE ALSO | ||||||||||
| 103 | |||||||||||
| 104 | L<XML::DOM2>,L<XML::DOM2::DOM::Attribute> | ||||||||||
| 105 | |||||||||||
| 106 | =cut | ||||||||||
| 107 | 4 | return 1; | |||||||||