diff Lib/IMPL/DOM/Navigator/Builder.pm @ 35:f25d021780b3

DOM::Navigator::Builder working version
author Sergey
date Tue, 17 Nov 2009 17:46:24 +0300
parents a8086f85a571
children 16ada169ca75
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Navigator/Builder.pm	Mon Nov 16 18:39:25 2009 +0300
+++ b/Lib/IMPL/DOM/Navigator/Builder.pm	Tue Nov 17 17:46:24 2009 +0300
@@ -19,7 +19,7 @@
     my ($this,$docClass,$schema) = @_;
     
     $this->{$_docClass} = $docClass;
-    $this->{$_schemaNavi} = IMPL::DOM::Navigator::SchemaNavigator->new($schema);
+    $this->{$_schemaNavi} = $schema ? IMPL::DOM::Navigator::SchemaNavigator->new($schema) : undef;
 }
 
 sub NavigateCreate {
@@ -32,7 +32,7 @@
         if (! $this->{$Document}) {
             $node = $this->{$Document} = $this->{$_docClass}->new(nodeName => $nodeName,%props);
         } else {
-            die new IMPL::InvalidOperationException('Can\t create a second top level element');
+            die new IMPL::InvalidOperationException('Can\t create a second top level element') unless $this->{$_nodeCurrent};
             $node = $this->{$Document}->Create($nodeName,$class,\%props);
             push @{$this->{$_nodesPath}}, $this->{$_nodeCurrent};
             $this->{$_nodeCurrent}->appendChild($node);