Mercurial > pub > Impl
annotate Lib/IMPL/DOM/Schema/Node.pm @ 138:c5bc900eefd3
IMPL::Web::Application: Fixed file uploading
Minor improvements in the IMPL::Web::TT::Form
author | wizard |
---|---|
date | Thu, 01 Jul 2010 04:25:07 +0400 |
parents | 196bf443b5e1 |
children | e6447ad85cb4 |
rev | line source |
---|---|
49 | 1 package IMPL::DOM::Schema::Node; |
2 use strict; | |
3 use warnings; | |
4 | |
5 use base qw(IMPL::DOM::Node); | |
6 use IMPL::Class::Property; | |
7 use IMPL::DOM::Property qw(_dom); | |
8 use IMPL::Class::Property::Direct; | |
9 | |
10 BEGIN { | |
11 public _direct property minOccur => prop_all; | |
12 public _direct property maxOccur => prop_all; | |
13 public _direct property type => prop_all; | |
14 public _direct property name => prop_all; | |
100 | 15 public _direct property display => prop_all; |
16 public _direct property display_no => prop_all; | |
17 public _direct property display_blame => prop_all; | |
49 | 18 } |
19 | |
20 our %CTOR = ( | |
21 'IMPL::DOM::Node' => sub {my %args = @_; $args{nodeName} ||= 'Node'; %args} | |
22 ); | |
23 | |
24 sub CTOR { | |
25 my ($this,%args) = @_; | |
26 | |
27 $this->{$minOccur} = defined $args{minOccur} ? $args{minOccur} : 1; | |
28 $this->{$maxOccur} = defined $args{maxOccur} ? $args{maxOccur} : 1; | |
29 $this->{$type} = $args{type}; | |
30 $this->{$name} = $args{name} or die new IMPL::InvalidArgumentException('Argument is required','name'); | |
100 | 31 $this->{$display} = $args{display}; |
32 $this->{$display_no} = $args{display_no}; | |
33 $this->{$display_blame} = $args{display_blame}; | |
49 | 34 } |
35 | |
36 sub Validate { | |
37 my ($this,$node) = @_; | |
38 | |
39 if (my $schemaType = $this->{$type} ? $this->document->resolveType($this->{$type}) : undef ) { | |
104
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
103
diff
changeset
|
40 my @errors = $schemaType->Validate($node,{Source => $this}); |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
103
diff
changeset
|
41 return @errors; |
49 | 42 } else { |
43 return (); | |
44 } | |
45 } | |
46 | |
104
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
103
diff
changeset
|
47 sub inflateValue { |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
103
diff
changeset
|
48 $_[1]; |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
103
diff
changeset
|
49 } |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
103
diff
changeset
|
50 |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
103
diff
changeset
|
51 sub inflator { undef } |
103 | 52 |
49 | 53 sub qname { |
54 $_[0]->nodeName.'[name='.$_[0]->{$name}.']'; | |
55 } | |
56 | |
57 1; | |
58 | |
59 __END__ | |
60 =pod | |
61 | |
62 =head1 SYNOPSIS | |
63 | |
104
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
103
diff
changeset
|
64 package SchemaEntity; |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
103
diff
changeset
|
65 use base qw(IMPL::DOM::Schema::Node); |
49 | 66 |
67 sub Validate { | |
68 my ($this,$node) = @_; | |
69 } | |
70 | |
71 =head1 DESCRIPTION | |
72 | |
73 Базовый класс для элементов схемы. | |
74 | |
75 =cut |