line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::IODEF; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
73949
|
use 5.008008; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
5
|
1
|
|
|
1
|
|
12
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.11_3'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
410
|
use XML::Compile::Schema; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use XML::Compile::Util qw/pack_type/; |
11
|
|
|
|
|
|
|
use XML::LibXML; |
12
|
|
|
|
|
|
|
use Data::Dumper; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
XML::Compile->addSchemaDirs(__FILE__); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
|
|
|
|
|
|
my $class = shift; |
18
|
|
|
|
|
|
|
my $args = shift; |
19
|
|
|
|
|
|
|
my $self = {}; |
20
|
|
|
|
|
|
|
bless($self,$class); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $type = pack_type 'urn:ietf:params:xml:ns:iodef-1.0', 'IODEF-Document'; |
23
|
|
|
|
|
|
|
my $s = XML::Compile::Schema->new('iodef.xsd'); |
24
|
|
|
|
|
|
|
my $doc = XML::LibXML::Document->new('1.0', 'UTF-8'); |
25
|
|
|
|
|
|
|
my $writer = $s->compile(WRITER => $type, prefixes => [ iodef => 'urn:ietf:params:xml:ns:iodef-1.0' ]); |
26
|
|
|
|
|
|
|
$self->writer($writer); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return($self); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub out { |
32
|
|
|
|
|
|
|
my $self = shift; |
33
|
|
|
|
|
|
|
my $hash = shift; |
34
|
|
|
|
|
|
|
my $pretty = shift || 0; |
35
|
|
|
|
|
|
|
my $doc = XML::LibXML::Document->new('1.0', 'UTF-8'); |
36
|
|
|
|
|
|
|
my $xml = $self->writer->($doc, $hash); |
37
|
|
|
|
|
|
|
return $xml->toString($pretty); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub writer { |
41
|
|
|
|
|
|
|
my ($self,$v) = @_; |
42
|
|
|
|
|
|
|
$self->{'_writer'} = $v if(defined($v)); |
43
|
|
|
|
|
|
|
return $self->{'_writer'}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Preloaded methods go here. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
__END__ |