| 1 | package HTTP::OAI::SAX::Text; | ||||||||||
| 2 | |||||||||||
| 3 | 11 | @ISA = qw( XML::SAX::Base ); | |||||||||
| 4 | |||||||||||
| 5 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 11 | our $VERSION = '4.11'; | |||||||||
| 8 | |||||||||||
| 9 | sub start_element | ||||||||||
| 10 | { | ||||||||||
| 11 | 493 | ▶ | ( my $self, my $hash, @_ ) = @_; | ||||||||
|
Subroutine
start_element: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 12 | |||||||||||
| 13 | 493 | $self->{Data} = ""; | |||||||||
| 14 | 493 | push @{$self->{Attributes}}, $hash->{Attributes}; | |||||||||
| 15 | |||||||||||
| 16 | 493 | $self->SUPER::start_element( $hash, @_ ); | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 772 | ▶ | sub characters { $_[0]->{Data} .= $_[1]->{Data} } | ||||||||
|
Subroutine
characters: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 20 | |||||||||||
| 21 | sub end_element | ||||||||||
| 22 | { | ||||||||||
| 23 | 484 | ▶ | ( my $self, my $hash, @_ ) = @_; | ||||||||
|
Subroutine
end_element: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 24 | |||||||||||
| 25 | 484 | $hash->{Text} = $self->{Data}; | |||||||||
| 26 | 484 | ▶ | $hash->{Attributes} = pop @{$self->{Attributes} || []}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | # strip surrounding whitespace in leaf nodes | ||||||||||
| 29 | 484 | $hash->{Text} =~ s/^\s+//; | |||||||||
| 30 | 484 | $hash->{Text} =~ s/\s+$//; | |||||||||
| 31 | |||||||||||
| 32 | 484 | $self->SUPER::characters( {Data => $self->{Data}}, @_ ); | |||||||||
| 33 | |||||||||||
| 34 | 484 | $self->{Data} = ""; | |||||||||
| 35 | |||||||||||
| 36 | 484 | $self->SUPER::end_element( $hash, @_ ); | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 11 | 1; | |||||||||
| 40 | |||||||||||
| 41 | =head1 NAME | ||||||||||
| 42 | |||||||||||
| 43 | HTTP::OAI::SAX::Text | ||||||||||
| 44 | |||||||||||
| 45 | =head1 DESCRIPTION | ||||||||||
| 46 | |||||||||||
| 47 | This module adds Text and Attributes to the end_element call. This is only useful for leaf nodes (elements that don't contain any child elements). | ||||||||||