| 1 | package HTTP::OAI::Metadata; | ||||||||||
| 2 | |||||||||||
| 3 | 11 | @ISA = qw( HTTP::OAI::MemberMixin HTTP::OAI::SAX::Base ); | |||||||||
| 4 | |||||||||||
| 5 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 11 | our $VERSION = '4.07'; | |||||||||
| 8 | |||||||||||
| 9 | sub new | ||||||||||
| 10 | { | ||||||||||
| 11 | 15 | ▶ | my( $class, %self ) = @_; | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 12 | |||||||||||
| 13 | 15 | $self{doc} = XML::LibXML::Document->new( '1.0', 'UTF-8' ); | |||||||||
| 14 | 15 | $self{dom} = $self{current} = $self{doc}->createDocumentFragment; | |||||||||
| 15 | |||||||||||
| 16 | 15 | return bless \%self, $class; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | sub metadata { shift->dom( @_ ) } | ||||||||
|
Subroutine
metadata: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 20 | 4 | ▶ | sub dom { shift->_elem( "dom", @_ ) } | ||||||||
|
Subroutine
dom: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 21 | |||||||||||
| 22 | sub generate | ||||||||||
| 23 | { | ||||||||||
| 24 | 3 | ▶ | my( $self, $driver ) = @_; | ||||||||
|
Subroutine
generate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 25 | |||||||||||
| 26 | 3 | $driver->generate( $self->dom ); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | sub start_element | ||||||||||
| 30 | { | ||||||||||
| 31 | 175 | ▶ | my( $self, $hash ) = @_; | ||||||||
|
Subroutine
start_element: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 32 | |||||||||||
| 33 | my $node = $self->{doc}->createElementNS( | ||||||||||
| 34 | $hash->{NamespaceURI}, | ||||||||||
| 35 | $hash->{Name}, | ||||||||||
| 36 | 175 | ); | |||||||||
| 37 | 175 | foreach my $attr (values %{$hash->{Attributes}}) | |||||||||
| 38 | { | ||||||||||
| 39 | 119 | ▶ | Carp::confess "Can't setAttribute without attribute name" if !defined $attr->{Name}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 119 | $node->setAttribute( $attr->{Name}, $attr->{Value} ); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 175 | $self->{current} = $self->{current}->appendChild( $node ); | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | sub end_element | ||||||||||
| 47 | { | ||||||||||
| 48 | 175 | ▶ | my( $self, $hash ) = @_; | ||||||||
|
Subroutine
end_element: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 49 | |||||||||||
| 50 | 175 | $self->{current} = $self->{current}->parentNode; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | sub characters | ||||||||||
| 54 | { | ||||||||||
| 55 | 175 | ▶ | my( $self, $hash ) = @_; | ||||||||
|
Subroutine
characters: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 56 | |||||||||||
| 57 | 175 | $self->{current}->appendText( $hash->{Data} ); | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | 11 | 1; | |||||||||
| 61 | |||||||||||
| 62 | __END__ | ||||||||||