diff Lib/IMPL/DOM/Navigator/Builder.pm @ 13:bb8d67f811ea

merge heads
author Sergey
date Wed, 02 Sep 2009 23:11:14 +0400
parents 955b2324c1bf 75980091813b
children 65a7bb156fb7
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Navigator/Builder.pm	Mon Aug 31 01:37:43 2009 +0400
+++ b/Lib/IMPL/DOM/Navigator/Builder.pm	Wed Sep 02 23:11:14 2009 +0400
@@ -3,36 +3,32 @@
 use warnings;
 
 use base qw(IMPL::DOM::Navigator);
-
 use IMPL::Class::Property;
+use IMPL::Class::Property::Direct;
 
 BEGIN {
-    public property SchemaNavigator => prop_get | owner_set;
+    protected _direct property _navigatorSchema => prop_all;
+    public _direct property Document => prop_get | owner_set;
+}
+
+__PACKAGE__->PassThroughArgs;
+
+sub CTOR {
+    my ($this,$domDocument,$schema) = @_;
+    
+    $this->{$Document} = $domDocument;
+    $this->{$_navigatorSchema} = new IMPL::DOM::Navigator($schema);
+}
+
+sub NavigateCreate {
+    my ($this,$nodeName,%props) = @_;
+    
+    if ( my $nodeSchema = $this->{$_navigatorSchema}->Navigate($nodeName) ) {
+        
+        
+    } else {
+        die new IMPL::InvalidOperationException("Requested elemnt not found in the schema");
+    }
 }
 
 1;
-
-=pod
-
-=head1 SYNOPSIS
-
-my $nav = new IMPL::DOM::Navigator::Builder(Schema => $mySchema);
-
-# set position to root
-$nav->InitRoot();
-
-# go to node 'Person' and create one if not exists
-$nav->NavigateAuto("Person");
-
-# set some node properties
-$nav->nodeCurrent->Name("Smith");
-$nav->nodeCurrent->Age("20");
-
-# navigate to node 'Address' and create one if not exists
-$nav->NavigateAuto("Address");
-
-=head1 DESCRIPTION
-
-Навигатор, который позволяет формировать документ в соответствии со схемой
-
-=cut
\ No newline at end of file