7
|
1 package IMPL::DOM::Schema::ComplexNode;
|
|
2 use strict;
|
|
3 use warnings;
|
|
4
|
|
5 use base qw(IMPL::DOM::Schema::Item);
|
|
6 use IMPL::Class::Property;
|
|
7
|
|
8 BEGIN {
|
|
9 public property nodeType => prop_all;
|
|
10 public property content => {
|
|
11 get => \&_getContent,
|
|
12 set => \&_setContent
|
|
13 }
|
|
14 }
|
|
15
|
|
16 __PACKAGE__->PassThroughArgs;
|
|
17
|
|
18 sub _getContent {
|
|
19 $_[0]->firstChild;
|
|
20 }
|
|
21
|
|
22 sub _setContent {
|
|
23 $_[0]->firstChild($_[1]);
|
|
24 }
|
|
25
|
|
26 sub Validate {
|
|
27 my ($this,$node) = @_;
|
|
28
|
|
29 if (my $type = $this->nodeType) {
|
|
30 my $schemaType = $this->Schema->ResolveType($type);
|
|
31 return $schemaType->Validate($node);
|
|
32 } else {
|
|
33 my @errors;
|
|
34 push @errors, $_->Validate foreach @{$this->childNodes};
|
|
35
|
8
|
36 return @errors;
|
7
|
37 }
|
|
38 }
|
|
39
|
|
40 1;
|
|
41
|
|
42 __END__
|
|
43
|
|
44 =pod
|
|
45
|
|
46 =head1 DESCRIPTION
|
|
47
|
|
48 . ,
|
|
49 .
|
|
50
|
|
51 ..
|
|
52 , . C<content>
|
|
53
|
|
54 =head2 PROPERTIES
|
|
55
|
|
56 =over
|
|
57
|
|
58 =item C<nodeType>
|
|
59
|
|
60 , .
|
|
61 C<content> .
|
|
62
|
|
63 =item C<content>
|
|
64
|
|
65 , C<IMPL::DOM::Schema::NodeSet>
|
|
66 C<IMPL::DOM::Schema::NodeList>, .
|
|
67 .
|
|
68
|
|
69 =back
|
|
70
|
|
71 =cut
|