diff lib/IMPL/DOM/Navigator/SimpleBuilder.pm @ 407:c6e90e02dd17 ref20150831

renamed Lib->lib
author cin
date Fri, 04 Sep 2015 19:40:23 +0300
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/IMPL/DOM/Navigator/SimpleBuilder.pm	Fri Sep 04 19:40:23 2015 +0300
@@ -0,0 +1,40 @@
+package IMPL::DOM::Navigator::SimpleBuilder;
+use strict;
+use warnings;
+
+use parent qw(IMPL::DOM::Navigator);
+
+use IMPL::Class::Property;
+
+require IMPL::DOM::Navigator::SchemaNavigator;
+use IMPL::DOM::Document;
+
+BEGIN {
+    public _direct property Document => prop_get | owner_set;
+}
+
+our %CTOR = (
+    'IMPL::DOM::Navigator' => sub { IMPL::DOM::Document::Empty; }
+);
+
+sub NavigateCreate {
+    my ($this,$nodeName,%props) = @_;
+    
+    my $node;
+    if (! $this->{$Document}) {
+        $node = $this->{$Document} = IMPL::DOM::Document->new(nodeName => $nodeName,%props);
+        $this->_initNavigator($node);
+    } else {
+        die new IMPL::InvalidOperationException('Can     create a second top level element') unless $this->Current;
+        $node = $this->{$Document}->Create($nodeName,'IMPL::DOM::Node',\%props);
+        $this->Current->appendChild($node);
+        $this->internalNavigateNodeSet($node);
+    }
+    return $node;
+}
+
+sub inflateValue {
+    $_[1];
+}
+
+1;