annotate lib/IMPL/DOM/Navigator/SimpleBuilder.pm @ 408:5c80e33f1218 ref20150831

added 'coarsen' function
author cin
date Mon, 07 Sep 2015 01:35:25 +0300
parents c6e90e02dd17
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
1 package IMPL::DOM::Navigator::SimpleBuilder;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
2 use strict;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
3 use warnings;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
4
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
5 use parent qw(IMPL::DOM::Navigator);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
6
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
7 use IMPL::Class::Property;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
8
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
9 require IMPL::DOM::Navigator::SchemaNavigator;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
10 use IMPL::DOM::Document;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
11
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
12 BEGIN {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
13 public _direct property Document => prop_get | owner_set;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
14 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
15
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
16 our %CTOR = (
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
17 'IMPL::DOM::Navigator' => sub { IMPL::DOM::Document::Empty; }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
18 );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
19
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
20 sub NavigateCreate {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
21 my ($this,$nodeName,%props) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
22
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
23 my $node;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
24 if (! $this->{$Document}) {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
25 $node = $this->{$Document} = IMPL::DOM::Document->new(nodeName => $nodeName,%props);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
26 $this->_initNavigator($node);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
27 } else {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
28 die new IMPL::InvalidOperationException('Can create a second top level element') unless $this->Current;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
29 $node = $this->{$Document}->Create($nodeName,'IMPL::DOM::Node',\%props);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
30 $this->Current->appendChild($node);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
31 $this->internalNavigateNodeSet($node);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
32 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
33 return $node;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
34 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
35
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
36 sub inflateValue {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
37 $_[1];
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
38 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
39
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
40 1;