diff Lib/IMPL/DOM/Navigator/Builder.pm @ 14:65a7bb156fb7

Дом модель и схема
author Sergey
date Fri, 04 Sep 2009 16:38:15 +0400
parents bb8d67f811ea
children 16795016e70b
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Navigator/Builder.pm	Wed Sep 02 23:11:14 2009 +0400
+++ b/Lib/IMPL/DOM/Navigator/Builder.pm	Fri Sep 04 16:38:15 2009 +0400
@@ -23,8 +23,13 @@
 sub NavigateCreate {
     my ($this,$nodeName,%props) = @_;
     
-    if ( my $nodeSchema = $this->{$_navigatorSchema}->Navigate($nodeName) ) {
+    if ( my $nodeSchema = $this->{$_navigatorSchema}->Navigate(sub { $_[0]->nodeName eq $nodeName or $_[0]->isa('IMPL::DOM::Schema::AnyNode') }) ) {
+        my $class = $nodeSchema->type;
         
+        my $node = $this->{$Document}->Create($nodeName, $class, \%props);
+        
+        $this->Current()->appendNode($node);
+        $this->Current($node);
         
     } else {
         die new IMPL::InvalidOperationException("Requested elemnt not found in the schema");