210
|
1 #!/usr/bin/perl
|
|
2 use strict;
|
|
3
|
215
|
4 use XML::Compile::Schema;
|
219
|
5 use XML::Compile::Util qw(pack_type pack_id);
|
215
|
6 use Data::Dumper;
|
210
|
7 use Time::HiRes qw(gettimeofday tv_interval);
|
|
8
|
219
|
9 my $schema = XML::Compile::Schema->new('Resources/resources.xsd');
|
215
|
10
|
|
11 $schema->printIndex();
|
210
|
12
|
219
|
13 my $type = pack_type 'http://implab.org/schemas/resources', 'resources';
|
220
|
14 my $reader = $schema->compile(
|
|
15 READER => $type,
|
|
16 xsi_type => {
|
223
|
17 pack_type('http://implab.org/schemas/resources','AbstractResult') => 'AUTO'
|
220
|
18 }
|
|
19 );
|
210
|
20
|
|
21 my $t = [gettimeofday];
|
|
22
|
219
|
23 my $obj = $reader->('Resources/sample.xml');
|
210
|
24
|
215
|
25 print "Parsing small Xml file: ",tv_interval($t,[gettimeofday]),"\n";
|
210
|
26
|
215
|
27 print Dumper( $obj );
|
|
28
|
|
29
|