annotate Lib/IMPL/DOM/Navigator/SimpleBuilder.pm @ 96:4c55aed00ff2

Minor changes
author wizard
date Fri, 30 Apr 2010 15:03:38 +0400
parents 16ada169ca75
children c289ed9662ca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
1 package IMPL::DOM::Navigator::SimpleBuilder;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
5 use base qw(IMPL::DOM::Navigator);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
6
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
7 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
8 use IMPL::Class::Property::Direct;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
9
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
10 require IMPL::DOM::Navigator::SchemaNavigator;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
11 use IMPL::DOM::Document;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
12
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
13 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
14 public _direct property Document => prop_get | owner_set;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
15 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
16
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
17 our %CTOR = (
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
18 'IMPL::DOM::Navigator' => sub { IMPL::DOM::Document::Empty; }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
19 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
20
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
21 sub NavigateCreate {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
22 my ($this,$nodeName,%props) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
23
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
24 my $node;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
25 if (! $this->{$Document}) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
26 $node = $this->{$Document} = IMPL::DOM::Document->new(nodeName => $nodeName,%props);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
27 $this->_initNavigator($node);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
28 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
29 die new IMPL::InvalidOperationException('Can\t create a second top level element') unless $this->Current;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
30 $node = $this->{$Document}->Create($nodeName,'IMPL::DOM::Node',\%props);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
31 $this->Current->appendChild($node);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
32 $this->internalNavigateNodeSet($node);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
33 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
34 return $node;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
35 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
36
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 36
diff changeset
37 1;