line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SRU::Utils::XML; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$SRU::Utils::XML::VERSION = '1.01'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
#ABSTRACT: XML utility functions for SRU |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
80
|
|
8
|
2
|
|
|
2
|
|
1425
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
9
|
2
|
|
|
2
|
|
10
|
use base qw( Exporter ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
672
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw( element elementNoEscape escape stylesheet ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub element { |
15
|
0
|
|
|
0
|
1
|
|
my ($tag, $text) = @_; |
16
|
0
|
0
|
|
|
|
|
return '' if ! defined $text; |
17
|
0
|
|
|
|
|
|
return "<$tag>" . escape($text) . "$tag>"; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub elementNoEscape { |
22
|
0
|
|
|
0
|
1
|
|
my ($tag, $text) = @_; |
23
|
0
|
0
|
|
|
|
|
return '' if ! defined $text; |
24
|
0
|
|
|
|
|
|
return "<$tag>$text$tag>"; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub escape { |
29
|
0
|
|
0
|
0
|
1
|
|
my $text = shift || ''; |
30
|
0
|
|
|
|
|
|
$text =~ s/</g; |
31
|
0
|
|
|
|
|
|
$text =~ s/>/>/g; |
32
|
0
|
|
|
|
|
|
$text =~ s/&/&/g; |
33
|
0
|
|
|
|
|
|
return $text; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub stylesheet { |
38
|
0
|
|
|
0
|
1
|
|
my $uri = shift; |
39
|
0
|
|
|
|
|
|
return qq(); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |