annotate Lib/IMPL/DOM/Schema/ComplexNode.pm @ 125:a4b0a819bbda

Small fixes in IMPL::DOM::Schema
author wizard
date Thu, 10 Jun 2010 17:43:51 +0400
parents a6e9759ff88a
children 76515373dac0
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: 20
diff changeset
1 package IMPL::DOM::Schema::ComplexNode;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
5 use base qw(IMPL::DOM::Schema::Node);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
6 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
7
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
8 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
9 public property content => {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
10 get => \&_getContent,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
11 set => \&_setContent
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
12 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
13 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
14
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
15 our %CTOR = (
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
16 'IMPL::DOM::Schema::Node' => sub {my %args = @_; $args{nodeName} ||= 'ComplexNode'; %args }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
17 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
18
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
19 sub _getContent {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
20 $_[0]->firstChild;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
21 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
22
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
23 sub _setContent {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
24 $_[0]->firstChild($_[1]);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
25 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
26
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
27 sub Validate {
105
a6e9759ff88a Fixed a validation errors parameters
wizard
parents: 49
diff changeset
28 my ($this,$node,$ctx) = @_;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
29
105
a6e9759ff88a Fixed a validation errors parameters
wizard
parents: 49
diff changeset
30 map $_->Validate($node,$ctx), @{$this->childNodes};
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
31 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
32
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
33 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
34
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
35 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
36
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
37 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
38
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
39 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
40
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
41 Описывает сложный узел. Требует либо соответствие структуры, либо соответствия
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
42 типу.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
43
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
44 Дочерними элементами могут быть правила контроля свойств и т.п.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
45 Первым дочерним элементом может быть только содержимое узла, см. C<content>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
46
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
47 =head2 PROPERTIES
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
48
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
49 =over
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
50
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
51 =item C<content>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
52
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
53 Содержимое узла, может быть либо C<IMPL::DOM::Schema::NodeSet> либо
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
54 C<IMPL::DOM::Schema::NodeList>, в зависимости от того важен порядок или нет.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
55 Это свойство ссылается на первый дочерний элемент узла.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
56
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
57 =back
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
58
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
59 =cut