diff _test/Test/DOM/Builder.pm @ 35:f25d021780b3

DOM::Navigator::Builder working version
author Sergey
date Tue, 17 Nov 2009 17:46:24 +0300
parents a8086f85a571
children 1828103371d0
line wrap: on
line diff
--- a/_test/Test/DOM/Builder.pm	Mon Nov 16 18:39:25 2009 +0300
+++ b/_test/Test/DOM/Builder.pm	Tue Nov 17 17:46:24 2009 +0300
@@ -25,7 +25,7 @@
             IMPL::DOM::Schema::NodeSet->new()->appendRange(
                 new IMPL::DOM::Schema::SimpleNode( name => 'firstName' ),
                 new IMPL::DOM::Schema::SimpleNode( name => 'lastName' ),
-                new IMPL::DOM::Schema::ComplexNode( name => 'address' )->appendRange(
+                new IMPL::DOM::Schema::ComplexNode( name => 'address', maxOccur => 'unbounded' )->appendRange(
                     IMPL::DOM::Schema::NodeSet->new()->appendRange(
                         new IMPL::DOM::Schema::SimpleNode( name => 'street' ),
                         new IMPL::DOM::Schema::SimpleNode( name => 'line', minOccur => 0 )
@@ -55,15 +55,32 @@
         $this->schemaDoc
     );
     
+    use Time::HiRes qw(gettimeofday tv_interval);
+    
+    my $t = [gettimeofday];
+    
     $builder->NavigateCreate('personInfo', version => '1');
         $builder->NavigateCreate('firstName')->nodeValue('Nemo');
         $builder->Back();
-        $builder->NavigateCreate('address', local => 1);
-            $builder->NavigateCreate('street')->nodeValue('Hellroad');
+        $builder->NavigateCreate('lastName')->nodeValue('Nobel');
+        $builder->Back();
+        $builder->NavigateCreate('lastName')->nodeValue('Gardum');
+        $builder->Back();
+        for(1..100) {
+            $builder->NavigateCreate('address', local => 1);
+                $builder->NavigateCreate('street')->nodeValue('Hellroad');
+                $builder->Back();
+                $builder->NavigateCreate('line')->nodeValue($_);
+                $builder->Back();
             $builder->Back();
-        $builder->Back();
+        }
     $builder->Back();
     
+    print "Build: ",tv_interval($t,[gettimeofday]),"\n";
+    $t = [gettimeofday];
+    print $_->Message,"\n" foreach $this->schemaDoc->Validate($builder->Document);
+    print "Validate: ",tv_interval($t,[gettimeofday]),"\n";
+    
     return 1;
 };