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