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';
|
215
|
14 my $reader = $schema->compile(READER => $type);
|
210
|
15
|
|
16 my $t = [gettimeofday];
|
|
17
|
219
|
18 my $obj = $reader->('Resources/sample.xml');
|
210
|
19
|
215
|
20 print "Parsing small Xml file: ",tv_interval($t,[gettimeofday]),"\n";
|
210
|
21
|
215
|
22 print Dumper( $obj );
|
|
23
|
|
24
|