49
|
1 package IMPL::DOM::Navigator::SimpleBuilder;
|
|
2 use strict;
|
|
3 use warnings;
|
|
4
|
165
|
5 use parent qw(IMPL::DOM::Navigator);
|
49
|
6
|
|
7 use IMPL::Class::Property;
|
|
8
|
|
9 require IMPL::DOM::Navigator::SchemaNavigator;
|
|
10 use IMPL::DOM::Document;
|
|
11
|
|
12 BEGIN {
|
|
13 public _direct property Document => prop_get | owner_set;
|
|
14 }
|
|
15
|
|
16 our %CTOR = (
|
|
17 'IMPL::DOM::Navigator' => sub { IMPL::DOM::Document::Empty; }
|
|
18 );
|
|
19
|
|
20 sub NavigateCreate {
|
|
21 my ($this,$nodeName,%props) = @_;
|
|
22
|
|
23 my $node;
|
|
24 if (! $this->{$Document}) {
|
|
25 $node = $this->{$Document} = IMPL::DOM::Document->new(nodeName => $nodeName,%props);
|
|
26 $this->_initNavigator($node);
|
|
27 } else {
|
206
|
28 die new IMPL::InvalidOperationException('Can create a second top level element') unless $this->Current;
|
49
|
29 $node = $this->{$Document}->Create($nodeName,'IMPL::DOM::Node',\%props);
|
|
30 $this->Current->appendChild($node);
|
|
31 $this->internalNavigateNodeSet($node);
|
|
32 }
|
|
33 return $node;
|
|
34 }
|
|
35
|
103
|
36 sub inflateValue {
|
194
|
37 $_[1];
|
103
|
38 }
|
|
39
|
49
|
40 1;
|