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
|
|
71
|
use strict; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
3115
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '4.12'; |
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
|
28
|
my( $self, $string ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
7
|
|
|
|
|
47
|
my $parser = XML::LibXML::SAX->new( |
21
|
|
|
|
|
|
|
Handler => HTTP::OAI::SAX::Text->new( |
22
|
|
|
|
|
|
|
Handler => $self, |
23
|
|
|
|
|
|
|
) |
24
|
|
|
|
|
|
|
); |
25
|
7
|
|
|
|
|
614
|
$parser->parse_string( $string ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub parse_file |
29
|
|
|
|
|
|
|
{ |
30
|
3
|
|
|
3
|
1
|
5
|
my( $self, $fh ) = @_; |
31
|
|
|
|
|
|
|
|
32
|
3
|
|
|
|
|
54
|
my $parser = XML::LibXML::SAX->new( |
33
|
|
|
|
|
|
|
Handler => HTTP::OAI::SAX::Text->new( |
34
|
|
|
|
|
|
|
Handler => $self, |
35
|
|
|
|
|
|
|
) |
36
|
|
|
|
|
|
|
); |
37
|
3
|
|
|
|
|
354
|
$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
|
376
|
my $self = shift; |
49
|
6
|
100
|
|
|
|
91
|
if( my $dom = shift ) { |
50
|
2
|
|
|
|
|
24
|
my $driver = XML::LibXML::SAX::Parser->new( |
51
|
|
|
|
|
|
|
Handler=>HTTP::OAI::SAXHandler->new( |
52
|
|
|
|
|
|
|
Handler=>$self |
53
|
|
|
|
|
|
|
)); |
54
|
2
|
|
|
|
|
83
|
$driver->generate($dom); |
55
|
|
|
|
|
|
|
} else { |
56
|
4
|
|
|
|
|
39
|
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
|
|
|
|
|
145
|
$self->generate( $driver ); |
61
|
4
|
|
|
|
|
48
|
$driver->end_oai_pmh(); |
62
|
|
|
|
|
|
|
|
63
|
4
|
|
|
|
|
196
|
return $builder->result; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |