annotate Lib/IMPL/DOM/Schema/ComplexNode.pm @ 404:9ef75f2029be default

sync
author cin
date Fri, 28 Aug 2015 19:54:53 +0300
parents 648dfaf642e0
children
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
388
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
5 use IMPL::declare {
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
6 base => [
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
7 'IMPL::DOM::Schema::Node' => sub {my %args = @_; $args{nodeName} ||= 'ComplexNode'; %args }
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
8 ],
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
9 props => [
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
10 content => {
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
11 get => \&_getContent,
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
12 set => \&_setContent
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
13 }
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
14 ]
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
15 };
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
16
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 sub _getContent {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
19 $_[0]->firstChild;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
20 }
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 sub _setContent {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
23 $_[0]->firstChild($_[1]);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
24 }
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 sub Validate {
105
a6e9759ff88a Fixed a validation errors parameters
wizard
parents: 49
diff changeset
27 my ($this,$node,$ctx) = @_;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
28
388
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
29 # для случаев анонимных типов, указанных прямо в узле
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
30 $ctx->{schemaNode} ||= $this;
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
31 $ctx->{schemaType} = $this;
648dfaf642e0 DOM refactoring,
cin
parents: 180
diff changeset
32
105
a6e9759ff88a Fixed a validation errors parameters
wizard
parents: 49
diff changeset
33 map $_->Validate($node,$ctx), @{$this->childNodes};
49
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
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
36 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
37
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
38 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
39
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
40 =pod
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 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
43
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
44 Описывает сложный узел. Требует либо соответствие структуры, либо соответствия
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
45 типу.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
46
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
47 Дочерними элементами могут быть правила контроля свойств и т.п.
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
48 Первым дочерним элементом может быть только содержимое узла, см. C<content>
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
50 =head2 PROPERTIES
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
51
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
52 =over
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
53
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
54 =item C<content>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
55
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
56 Содержимое узла, может быть либо C<IMPL::DOM::Schema::NodeSet> либо
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
57 C<IMPL::DOM::Schema::NodeList>, в зависимости от того важен порядок или нет.
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
58 Это свойство ссылается на первый дочерний элемент узла.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
59
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
60 =back
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
61
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
62 =cut