line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::OAI::SAX::Base; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
@ISA = qw( XML::SAX::Base ); |
4
|
|
|
|
|
|
|
|
5
|
11
|
|
|
11
|
|
72
|
use strict; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
3537
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '4.11'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub toString |
10
|
|
|
|
|
|
|
{ |
11
|
0
|
|
|
0
|
0
|
0
|
my $str = shift->dom->toString( 1 ); |
12
|
0
|
|
|
|
|
0
|
utf8::decode($str); |
13
|
0
|
|
|
|
|
0
|
return $str; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub parse_string |
17
|
|
|
|
|
|
|
{ |
18
|
7
|
|
|
7
|
1
|
30
|
my( $self, $string ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
7
|
|
|
|
|
63
|
my $parser = XML::LibXML::SAX->new( |
21
|
|
|
|
|
|
|
Handler => HTTP::OAI::SAX::Text->new( |
22
|
|
|
|
|
|
|
Handler => $self, |
23
|
|
|
|
|
|
|
) |
24
|
|
|
|
|
|
|
); |
25
|
7
|
|
|
|
|
725
|
$parser->parse_string( $string ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub parse_file |
29
|
|
|
|
|
|
|
{ |
30
|
3
|
|
|
3
|
1
|
9
|
my( $self, $fh ) = @_; |
31
|
|
|
|
|
|
|
|
32
|
3
|
|
|
|
|
87
|
my $parser = XML::LibXML::SAX->new( |
33
|
|
|
|
|
|
|
Handler => HTTP::OAI::SAX::Text->new( |
34
|
|
|
|
|
|
|
Handler => $self, |
35
|
|
|
|
|
|
|
) |
36
|
|
|
|
|
|
|
); |
37
|
3
|
|
|
|
|
469
|
$parser->parse_file( $fh ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub generate |
41
|
|
|
|
|
|
|
{ |
42
|
0
|
|
|
0
|
0
|
0
|
my( $self, $driver ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# override this |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub dom { |
48
|
6
|
|
|
6
|
0
|
431
|
my $self = shift; |
49
|
6
|
100
|
|
|
|
108
|
if( my $dom = shift ) { |
50
|
2
|
|
|
|
|
27
|
my $driver = XML::LibXML::SAX::Parser->new( |
51
|
|
|
|
|
|
|
Handler=>HTTP::OAI::SAXHandler->new( |
52
|
|
|
|
|
|
|
Handler=>$self |
53
|
|
|
|
|
|
|
)); |
54
|
2
|
|
|
|
|
96
|
$driver->generate($dom); |
55
|
|
|
|
|
|
|
} else { |
56
|
4
|
|
|
|
|
52
|
my $driver = HTTP::OAI::SAX::Driver->new( |
57
|
|
|
|
|
|
|
Handler => my $builder = XML::LibXML::SAX::Builder->new() |
58
|
|
|
|
|
|
|
); |
59
|
4
|
|
|
|
|
19
|
$driver->start_oai_pmh(); |
60
|
4
|
|
|
|
|
147
|
$self->generate( $driver ); |
61
|
4
|
|
|
|
|
55
|
$driver->end_oai_pmh(); |
62
|
|
|
|
|
|
|
|
63
|
4
|
|
|
|
|
250
|
return $builder->result; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |